Skip to content

Handle LSP requests for hearing about file saving of specific files#744

Merged
dzhou121 merged 1 commit intolapce:masterfrom
MinusGix:lsp-did-save-registration
Jul 5, 2022
Merged

Handle LSP requests for hearing about file saving of specific files#744
dzhou121 merged 1 commit intolapce:masterfrom
MinusGix:lsp-did-save-registration

Conversation

@MinusGix
Copy link
Copy Markdown
Member

@MinusGix MinusGix commented Jul 5, 2022

The current implementation of the LSP only sends didSave events when the file's language id matches the LSP's language id.
For LSPs like Rust-Analyzer, they also handle that event for other documents. For RA, it wants to hear about Cargo.toml and Cargo.lock specifically; so that it can update based on the changed results. While it will get the changed values the next time the user saves a Rust file, this isn't as good as it could be.
This just tells the LSP that we are willing to hear dynamic registration of what files it wants to hear updates about. The LSP protocol has these defined as globs, so I use the globset crate to match against those (which we already depended on through another dependency).
Currently it keeps the code for sending the updates to the client if their language id's match, though I'm unsure if that's the way the LSP spec wants that set up?

@MinusGix MinusGix added the A-lsp Area: LSP, assists and code completion label Jul 5, 2022
@dzhou121 dzhou121 merged commit 30e6236 into lapce:master Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lsp Area: LSP, assists and code completion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants