Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

lsp: Add support for label_details in completions (#13043)

Piotr Osiewicz55ba80ddd142
diff --git a/crates/languages/src/vtsls.rs b/crates/languages/src/vtsls.rs
index 4c23362a99d..cccbccfdbb4 100644
--- a/crates/languages/src/vtsls.rs
+++ b/crates/languages/src/vtsls.rs
@@ -138,9 +138,16 @@ impl LspAdapter for VtslsLspAdapter {
_ => None,
}?;
- let text = match &item.detail {
- Some(detail) => format!("{} {}", item.label, detail),
- None => item.label.clone(),
+ let text = if let Some(description) = item
+ .label_details
+ .as_ref()
+ .and_then(|label_details| label_details.description.as_ref())
+ {
+ format!("{} {}", item.label, description)
+ } else if let Some(detail) = &item.detail {
+ format!("{} {}", item.label, detail)
+ } else {
+ item.label.clone()
};
Some(language::CodeLabel {
diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs
index 3e3ac2557f7..256b13a1283 100644
--- a/crates/lsp/src/lsp.rs
+++ b/crates/lsp/src/lsp.rs
@@ -660,6 +660,7 @@ impl LanguageServer {
],
}),
insert_replace_support: Some(true),
+ label_details_support: Some(true),
..Default::default()
}),
completion_list: Some(CompletionListCapability {
@@ -670,6 +671,7 @@ impl LanguageServer {
"data".to_owned(),
]),
}),
+ context_support: Some(true),
..Default::default()
}),
rename: Some(RenameClientCapabilities {