lsp: Query first capable language server for requests using primary LS (#25591)

Release Notes:

- Improved Zed's handling of the following requests when the first
language server in language server settings for a given language is not
capable of handling them:
  - Perform Rename
  - Prepare Rename
  - Document Highlights
  - Find all references
  - Go to implementation
  - Go to definition
  - Go to declaration
  - Go to type definition
This commit is contained in:
Piotr Osiewicz 2025-02-25 22:12:13 +01:00 committed by GitHub
parent e5b6194914
commit 0066071a89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 105 additions and 99 deletions

View file

@ -2777,7 +2777,7 @@ impl Project {
) -> Task<Result<Vec<LocationLink>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
GetDefinition { position },
cx,
)
@ -2800,7 +2800,7 @@ impl Project {
) -> Task<Result<Vec<LocationLink>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
GetDeclaration { position },
cx,
)
@ -2824,7 +2824,7 @@ impl Project {
) -> Task<Result<Vec<LocationLink>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
GetTypeDefinition { position },
cx,
)
@ -2849,7 +2849,7 @@ impl Project {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
GetImplementation { position },
cx,
)
@ -2864,7 +2864,7 @@ impl Project {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
GetReferences { position },
cx,
)
@ -2878,7 +2878,7 @@ impl Project {
) -> Task<Result<Vec<DocumentHighlight>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
GetDocumentHighlights { position },
cx,
)
@ -3037,7 +3037,7 @@ impl Project {
) -> Task<Result<PrepareRenameResponse>> {
self.request_lsp(
buffer,
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
PrepareRename { position },
cx,
)
@ -3063,7 +3063,7 @@ impl Project {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer,
LanguageServerToQuery::Primary,
LanguageServerToQuery::FirstCapable,
PerformRename {
position,
new_name,