From cfba2fddf26854857ca9831dde579267d749d542 Mon Sep 17 00:00:00 2001 From: Esther Perelman Date: Thu, 17 Sep 2020 18:57:34 +0300 Subject: [PATCH] Issue-8310 Issue-8310: Deprecated code completions crash Signed-off-by: Esther Perelman --- packages/plugin-ext/src/plugin/plugin-context.ts | 2 ++ packages/plugin-ext/src/plugin/types-impl.ts | 5 +++++ packages/plugin/src/theia.d.ts | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/packages/plugin-ext/src/plugin/plugin-context.ts b/packages/plugin-ext/src/plugin/plugin-context.ts index 44905f41346ed..2216e8d7da7f6 100644 --- a/packages/plugin-ext/src/plugin/plugin-context.ts +++ b/packages/plugin-ext/src/plugin/plugin-context.ts @@ -64,6 +64,7 @@ import { DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, + CompletionItemTag, Location, LogLevel, Progress, @@ -850,6 +851,7 @@ export function createAPIFactory( Location, LogLevel, DiagnosticTag, + CompletionItemTag, Diagnostic, CompletionTriggerKind, TextEdit, diff --git a/packages/plugin-ext/src/plugin/types-impl.ts b/packages/plugin-ext/src/plugin/types-impl.ts index f083e2c6e5ef6..7542240c33fd3 100644 --- a/packages/plugin-ext/src/plugin/types-impl.ts +++ b/packages/plugin-ext/src/plugin/types-impl.ts @@ -736,6 +736,7 @@ export class CompletionItem implements theia.CompletionItem { label: string; kind?: CompletionItemKind; + tags?: CompletionItemTag[]; detail: string; documentation: string | MarkdownString; sortText: string; @@ -811,6 +812,10 @@ export enum DiagnosticTag { Unnecessary = 1, } +export enum CompletionItemTag { + Deprecated = 1, +} + export class Diagnostic { range: Range; message: string; diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index a613d7610f753..c98a4ad227002 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -6351,6 +6351,17 @@ declare module '@theia/plugin' { TypeParameter = 24 } + /** + * Completion item tags are extra annotations that tweak the rendering of a completion + * item. + */ + export enum CompletionItemTag { + /** + * Render a completion as obsolete, usually using a strike-out. + */ + Deprecated = 1 + } + /** * A completion item represents a text snippet that is proposed to complete text that is being typed. * @@ -6387,6 +6398,11 @@ declare module '@theia/plugin' { */ detail?: string; + /** + * Tags for this completion item. + */ + tags?: ReadonlyArray; + /** * A human-readable string that represents a doc-comment. */