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: Support deprecated completion item tag and advertise capability (#43000)

xdBronch9feb2602163a
diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs
index f220cadee5a..9a2b8c38568 100644
--- a/crates/editor/src/code_context_menus.rs
+++ b/crates/editor/src/code_context_menus.rs
@@ -8,6 +8,7 @@ use gpui::{
use itertools::Itertools;
use language::CodeLabel;
use language::{Buffer, LanguageName, LanguageRegistry};
+use lsp::CompletionItemTag;
use markdown::{Markdown, MarkdownElement};
use multi_buffer::{Anchor, ExcerptId};
use ordered_float::OrderedFloat;
@@ -840,7 +841,16 @@ impl CompletionsMenu {
if completion
.source
.lsp_completion(false)
- .and_then(|lsp_completion| lsp_completion.deprecated)
+ .and_then(|lsp_completion| {
+ match (lsp_completion.deprecated, &lsp_completion.tags)
+ {
+ (Some(true), _) => Some(true),
+ (_, Some(tags)) => Some(
+ tags.contains(&CompletionItemTag::DEPRECATED),
+ ),
+ _ => None,
+ }
+ })
.unwrap_or(false)
{
highlight.strikethrough = Some(StrikethroughStyle {
diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs
index 84e5a95ed80..af6760a3681 100644
--- a/crates/lsp/src/lsp.rs
+++ b/crates/lsp/src/lsp.rs
@@ -764,6 +764,10 @@ impl LanguageServer {
// "textEdit".to_string(),
],
}),
+ deprecated_support: Some(true),
+ tag_support: Some(TagSupport {
+ value_set: vec![CompletionItemTag::DEPRECATED],
+ }),
insert_replace_support: Some(true),
label_details_support: Some(true),
insert_text_mode_support: Some(InsertTextModeSupport {