Show deprecated completions for deprecated traits

This commit is contained in:
Kirill Bulatov 2021-01-19 01:08:59 +02:00
parent cc663a7b0c
commit ca65488276
8 changed files with 69 additions and 28 deletions

View file

@ -38,7 +38,10 @@ impl<'a> ConstRender<'a> {
let item = CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), name)
.kind(CompletionItemKind::Const)
.set_documentation(self.ctx.docs(self.const_))
.set_deprecated(self.ctx.is_deprecated(self.const_))
.set_deprecated(
self.ctx.is_deprecated(self.const_)
|| self.ctx.is_deprecated_assoc_item(self.const_),
)
.detail(detail)
.build();

View file

@ -44,7 +44,9 @@ impl<'a> FunctionRender<'a> {
CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), self.name.clone())
.kind(self.kind())
.set_documentation(self.ctx.docs(self.func))
.set_deprecated(self.ctx.is_deprecated(self.func))
.set_deprecated(
self.ctx.is_deprecated(self.func) || self.ctx.is_deprecated_assoc_item(self.func),
)
.detail(self.detail())
.add_call_parens(self.ctx.completion, self.name, params)
.add_import(import_to_add)

View file

@ -38,7 +38,10 @@ impl<'a> TypeAliasRender<'a> {
let item = CompletionItem::new(CompletionKind::Reference, self.ctx.source_range(), name)
.kind(CompletionItemKind::TypeAlias)
.set_documentation(self.ctx.docs(self.type_alias))
.set_deprecated(self.ctx.is_deprecated(self.type_alias))
.set_deprecated(
self.ctx.is_deprecated(self.type_alias)
|| self.ctx.is_deprecated_assoc_item(self.type_alias),
)
.detail(detail)
.build();