Skip to content

Commit 9316377

Browse files
xdBronchmikayla-maki
authored andcommitted
lsp: Support deprecated completion item tag and advertise capability (#43000)
Release Notes: - N/A
1 parent 37defc4 commit 9316377

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

crates/editor/src/code_context_menus.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use gpui::{
88
use itertools::Itertools;
99
use language::CodeLabel;
1010
use language::{Buffer, LanguageName, LanguageRegistry};
11+
use lsp::CompletionItemTag;
1112
use markdown::{Markdown, MarkdownElement};
1213
use multi_buffer::{Anchor, ExcerptId};
1314
use ordered_float::OrderedFloat;
@@ -840,7 +841,16 @@ impl CompletionsMenu {
840841
if completion
841842
.source
842843
.lsp_completion(false)
843-
.and_then(|lsp_completion| lsp_completion.deprecated)
844+
.and_then(|lsp_completion| {
845+
match (lsp_completion.deprecated, &lsp_completion.tags)
846+
{
847+
(Some(true), _) => Some(true),
848+
(_, Some(tags)) => Some(
849+
tags.contains(&CompletionItemTag::DEPRECATED),
850+
),
851+
_ => None,
852+
}
853+
})
844854
.unwrap_or(false)
845855
{
846856
highlight.strikethrough = Some(StrikethroughStyle {

crates/lsp/src/lsp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ impl LanguageServer {
764764
// "textEdit".to_string(),
765765
],
766766
}),
767+
deprecated_support: Some(true),
768+
tag_support: Some(TagSupport {
769+
value_set: vec![CompletionItemTag::DEPRECATED],
770+
}),
767771
insert_replace_support: Some(true),
768772
label_details_support: Some(true),
769773
insert_text_mode_support: Some(InsertTextModeSupport {

0 commit comments

Comments
 (0)