Respect language server's capabilities when calling GetReferences (#10285)

This PR makes Zed respect the language server's capabilities when
calling the `GetReferences` command (used in "Find All References",
etc.).

This fixes a crash that could occur when using Zed with Gleam v1.0.

Release Notes:

- Made "Find All References" respect the language server's capabilities.
This fixes some instances where certain language servers would stop
working after receiving a "Find All References" request.

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Marshall Bowers 2024-04-08 13:38:32 -04:00 committed by GitHub
parent f1428fea4e
commit 56c0345cf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View file

@ -903,6 +903,14 @@ impl LspCommand for GetReferences {
return Some("Finding references...".to_owned());
}
fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool {
match &capabilities.references_provider {
Some(OneOf::Left(has_support)) => *has_support,
Some(OneOf::Right(_)) => true,
None => false,
}
}
fn to_lsp(
&self,
path: &Path,