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

@ -4821,7 +4821,7 @@ async fn test_definition(
);
let definitions_1 = project_b
.update(cx_b, |p, cx| p.definition(&buffer_b, 23, cx))
.update(cx_b, |p, cx| p.definitions(&buffer_b, 23, cx))
.await
.unwrap();
cx_b.read(|cx| {
@ -4852,7 +4852,7 @@ async fn test_definition(
);
let definitions_2 = project_b
.update(cx_b, |p, cx| p.definition(&buffer_b, 33, cx))
.update(cx_b, |p, cx| p.definitions(&buffer_b, 33, cx))
.await
.unwrap();
cx_b.read(|cx| {
@ -4889,7 +4889,7 @@ async fn test_definition(
);
let type_definitions = project_b
.update(cx_b, |p, cx| p.type_definition(&buffer_b, 7, cx))
.update(cx_b, |p, cx| p.type_definitions(&buffer_b, 7, cx))
.await
.unwrap();
cx_b.read(|cx| {
@ -5057,7 +5057,7 @@ async fn test_references(
lsp_response_tx
.unbounded_send(Err(anyhow!("can't find references")))
.unwrap();
references.await.unwrap_err();
assert_eq!(references.await.unwrap(), []);
// User is informed that the request is no longer pending.
executor.run_until_parked();
@ -5641,7 +5641,7 @@ async fn test_open_buffer_while_getting_definition_pointing_to_it(
let definitions;
let buffer_b2;
if rng.r#gen() {
definitions = project_b.update(cx_b, |p, cx| p.definition(&buffer_b1, 23, cx));
definitions = project_b.update(cx_b, |p, cx| p.definitions(&buffer_b1, 23, cx));
(buffer_b2, _) = project_b
.update(cx_b, |p, cx| {
p.open_buffer_with_lsp((worktree_id, "b.rs"), cx)
@ -5655,7 +5655,7 @@ async fn test_open_buffer_while_getting_definition_pointing_to_it(
})
.await
.unwrap();
definitions = project_b.update(cx_b, |p, cx| p.definition(&buffer_b1, 23, cx));
definitions = project_b.update(cx_b, |p, cx| p.definitions(&buffer_b1, 23, cx));
}
let definitions = definitions.await.unwrap();

View file

@ -838,7 +838,7 @@ impl RandomizedTest for ProjectCollaborationTest {
.map(|_| Ok(()))
.boxed(),
LspRequestKind::Definition => project
.definition(&buffer, offset, cx)
.definitions(&buffer, offset, cx)
.map_ok(|_| ())
.boxed(),
LspRequestKind::Highlights => project