Use more LSP data when falling back to regular completions label (#23909)

Closes https://github.com/zed-industries/zed/issues/23590
Closes https://x.com/steeve/status/1865129235536568555

Before:

<img width="773" alt="before"
src="https://github.com/user-attachments/assets/129a8d12-9298-4bf5-8f2d-b3292c2562bf"
/>


After:

<img width="768" alt="after"
src="https://github.com/user-attachments/assets/e0516fb3-b02a-48be-8923-63bba05fdb69"
/>


The list obviously needs some solution for the cut-off part of the
completion label, but this is the reality for all extensions'
completions too, so one step at a time.


Release Notes:

- Improved default completion label fallback
This commit is contained in:
Kirill Bulatov 2025-01-30 17:05:34 +02:00 committed by GitHub
parent 48dba9a9d9
commit 9e4555797d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 62 additions and 12 deletions

View file

@ -11282,7 +11282,7 @@ async fn test_completions_resolve_updates_labels_if_filter_text_matches(
cx.simulate_keystroke(".");
let item1 = lsp::CompletionItem {
label: "id".to_string(),
label: "method id()".to_string(),
filter_text: Some("id".to_string()),
detail: None,
documentation: None,
@ -11332,7 +11332,7 @@ async fn test_completions_resolve_updates_labels_if_filter_text_matches(
.iter()
.map(|completion| &completion.label.text)
.collect::<Vec<_>>(),
vec!["id", "other"]
vec!["method id()", "other"]
)
}
CodeContextMenu::CodeActions(_) => panic!("Should show the completions menu"),
@ -11387,7 +11387,7 @@ async fn test_completions_resolve_updates_labels_if_filter_text_matches(
.iter()
.map(|completion| &completion.label.text)
.collect::<Vec<_>>(),
vec!["method id()", "other"],
vec!["method id() Now resolved!", "other"],
"Should update first completion label, but not second as the filter text did not match."
);
}