@patrick-doolan To flesh out a bit more how I envisioned this might work:
- LSP gains a new client capability,
vcsEnabled, which the client indicates is available if the opened workspace is under version control and the client is able to interface with the VCS (e.g. it has the right VCS plugin installed). - Conditional on this capability, LSP gains a set of new server → client requests which enable the server to query VCS-related information from the client.
- For the sake of this discussion, let’s imagine just one such request which is very tailored to this use case (but it could of course be more general). Let’s say something like
$/filesModifiedSince, which takes as input a commit identifier, and returns a list of files that have been modified since that commit.
- For the sake of this discussion, let’s imagine just one such request which is very tailored to this use case (but it could of course be more general). Let’s say something like
- On the server side, this request is invoked on startup (and perhaps periodically afterwards), with the input commit identifier taken from some configuration file (or read from the index, in which case we imagine we also had a
$/currentCommitrequest to get the current commit identifier for later storage), and uses the result to determine what to background-index. - On the client side, the request is answered by the client interfacing with the VCS.
- Internally, I imagine an extensible editor like vscode (which picks up VCS support via plugins) has an internal VCS-related interface (with VCS-agnostic representations for things like commit identifiers and diffs), which VCS plugins implement.
- Using vscode as an example client:
- Initially, the client-side implementation could live in vscode-clangd, and use the editor’s internal VCS interface to implement the request. This way, importantly, vscode-clangd does not need to know about specific VCS’s either.
- Eventually, as the above LSP requests get standardized, their client-side implementation can also be upstreamed from vscode-clangd into vscode itself.
Let me know if that makes sense / addresses your concerns.