Query multiple LSPs for more types of requests (#29359)

This fixes an issue where lower-priority language servers cannot provide
contentful responses even when the first capable server returned empty
responses.

Most of the diffs are copypasted since the existing implementations were
also copypasted.

Release Notes:

- Improved Go to Definition / Declaration / Type Definition /
Implementation and Find All References to include all results from
different language servers
This commit is contained in:
Iha Shin (신의하) 2025-07-03 02:51:19 +09:00 committed by GitHub
parent 105acacff9
commit 5f70a9cf59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 617 additions and 93 deletions

View file

@ -171,27 +171,27 @@ pub(crate) struct PerformRename {
pub push_to_history: bool,
}
#[derive(Debug)]
pub struct GetDefinition {
#[derive(Debug, Clone, Copy)]
pub struct GetDefinitions {
pub position: PointUtf16,
}
#[derive(Debug)]
pub(crate) struct GetDeclaration {
#[derive(Debug, Clone, Copy)]
pub(crate) struct GetDeclarations {
pub position: PointUtf16,
}
#[derive(Debug)]
pub(crate) struct GetTypeDefinition {
#[derive(Debug, Clone, Copy)]
pub(crate) struct GetTypeDefinitions {
pub position: PointUtf16,
}
#[derive(Debug)]
pub(crate) struct GetImplementation {
#[derive(Debug, Clone, Copy)]
pub(crate) struct GetImplementations {
pub position: PointUtf16,
}
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub(crate) struct GetReferences {
pub position: PointUtf16,
}
@ -588,7 +588,7 @@ impl LspCommand for PerformRename {
}
#[async_trait(?Send)]
impl LspCommand for GetDefinition {
impl LspCommand for GetDefinitions {
type Response = Vec<LocationLink>;
type LspRequest = lsp::request::GotoDefinition;
type ProtoRequest = proto::GetDefinition;
@ -690,7 +690,7 @@ impl LspCommand for GetDefinition {
}
#[async_trait(?Send)]
impl LspCommand for GetDeclaration {
impl LspCommand for GetDeclarations {
type Response = Vec<LocationLink>;
type LspRequest = lsp::request::GotoDeclaration;
type ProtoRequest = proto::GetDeclaration;
@ -793,7 +793,7 @@ impl LspCommand for GetDeclaration {
}
#[async_trait(?Send)]
impl LspCommand for GetImplementation {
impl LspCommand for GetImplementations {
type Response = Vec<LocationLink>;
type LspRequest = lsp::request::GotoImplementation;
type ProtoRequest = proto::GetImplementation;
@ -895,7 +895,7 @@ impl LspCommand for GetImplementation {
}
#[async_trait(?Send)]
impl LspCommand for GetTypeDefinition {
impl LspCommand for GetTypeDefinitions {
type Response = Vec<LocationLink>;
type LspRequest = lsp::request::GotoTypeDefinition;
type ProtoRequest = proto::GetTypeDefinition;