diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 2f5b498d4..46772dd22 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -329,6 +329,10 @@ impl Client { ], }), insert_replace_support: Some(true), + deprecated_support: Some(true), + tag_support: Some(lsp::TagSupport { + value_set: vec![lsp::CompletionItemTag::DEPRECATED], + }), ..Default::default() }), completion_item_kind: Some(lsp::CompletionItemKindCapability { diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index ac434894a..3e2f2aea4 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -1,6 +1,10 @@ use crate::compositor::{Component, Context, Event, EventResult}; -use helix_view::{editor::CompleteAction, ViewId}; -use tui::buffer::Buffer as Surface; +use helix_view::{ + editor::CompleteAction, + theme::{Modifier, Style}, + ViewId, +}; +use tui::{buffer::Buffer as Surface, text::Span}; use std::borrow::Cow; @@ -33,8 +37,19 @@ impl menu::Item for CompletionItem { } fn format(&self, _data: &Self::Data) -> menu::Row { + let deprecated = self.deprecated.unwrap_or_default() + || self.tags.as_ref().map_or(false, |tags| { + tags.contains(&lsp::CompletionItemTag::DEPRECATED) + }); menu::Row::new(vec![ - menu::Cell::from(self.label.as_str()), + menu::Cell::from(Span::styled( + self.label.as_str(), + if deprecated { + Style::default().add_modifier(Modifier::CROSSED_OUT) + } else { + Style::default() + }, + )), menu::Cell::from(match self.kind { Some(lsp::CompletionItemKind::TEXT) => "text", Some(lsp::CompletionItemKind::METHOD) => "method",