diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index 78610e6c004..7060c53fdfc 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -867,6 +867,9 @@ export const enum SymbolKind { TypeParameter = 25 } +export const enum SymbolKindTag { + Deprecated = 1, +} /** * @internal @@ -910,6 +913,7 @@ export interface DocumentSymbol { name: string; detail: string; kind: SymbolKind; + kindTags: SymbolKindTag[]; containerName?: string; range: IRange; selectionRange: IRange; diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts index 76ee0d96933..4aa60848562 100644 --- a/src/vs/editor/common/standalone/standaloneEnums.ts +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -660,4 +660,8 @@ export enum SymbolKind { Event = 23, Operator = 24, TypeParameter = 25 +} + +export enum SymbolKindTag { + Deprecated = 1 } \ No newline at end of file diff --git a/src/vs/editor/contrib/documentSymbols/media/outlineTree.css b/src/vs/editor/contrib/documentSymbols/media/outlineTree.css index ebc2389a0e2..3d6454a1556 100644 --- a/src/vs/editor/contrib/documentSymbols/media/outlineTree.css +++ b/src/vs/editor/contrib/documentSymbols/media/outlineTree.css @@ -20,6 +20,11 @@ color: var(--outline-element-color); } +.monaco-list .outline-element .deprecated { + text-decoration: line-through; + opacity: 0.66; +} + .monaco-tree .monaco-tree-row.focused .outline-element .outline-element-detail { visibility: inherit; } diff --git a/src/vs/editor/contrib/documentSymbols/outlineTree.ts b/src/vs/editor/contrib/documentSymbols/outlineTree.ts index 365b3e45c13..6df7d87e2ee 100644 --- a/src/vs/editor/contrib/documentSymbols/outlineTree.ts +++ b/src/vs/editor/contrib/documentSymbols/outlineTree.ts @@ -12,7 +12,7 @@ import { createMatches, FuzzyScore } from 'vs/base/common/filters'; import 'vs/css!./media/outlineTree'; import 'vs/css!./media/symbol-icons'; import { Range } from 'vs/editor/common/core/range'; -import { SymbolKind, symbolKindToCssClass } from 'vs/editor/common/modes'; +import { SymbolKind, symbolKindToCssClass, SymbolKindTag } from 'vs/editor/common/modes'; import { OutlineElement, OutlineGroup, OutlineModel } from 'vs/editor/contrib/documentSymbols/outlineModel'; import { localize } from 'vs/nls'; import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel'; @@ -127,6 +127,10 @@ export class OutlineElementRenderer implements ITreeRenderer= 0) { + options.extraClasses.push(`deprecated`); + options.matches = []; + } template.iconLabel.setLabel(element.symbol.name, element.symbol.detail, options); this._renderMarkerInfo(element, template); } diff --git a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts index b15a1451072..9622de2716e 100644 --- a/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts +++ b/src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts @@ -76,6 +76,7 @@ suite('OutlineModel', function () { name, detail: 'fake', kind: SymbolKind.Boolean, + kindTags: [], selectionRange: range, range: range }; diff --git a/src/vs/editor/contrib/quickOpen/quickOpen.ts b/src/vs/editor/contrib/quickOpen/quickOpen.ts index dba67c40b01..919e3eae792 100644 --- a/src/vs/editor/contrib/quickOpen/quickOpen.ts +++ b/src/vs/editor/contrib/quickOpen/quickOpen.ts @@ -51,6 +51,7 @@ function flatten(bucket: DocumentSymbol[], entries: DocumentSymbol[], overrideCo for (let entry of entries) { bucket.push({ kind: entry.kind, + kindTags: [], name: entry.name, detail: entry.detail, containerName: entry.containerName || overrideContainerLabel, diff --git a/src/vs/editor/standalone/browser/standaloneLanguages.ts b/src/vs/editor/standalone/browser/standaloneLanguages.ts index 30209af005c..0576af462b1 100644 --- a/src/vs/editor/standalone/browser/standaloneLanguages.ts +++ b/src/vs/editor/standalone/browser/standaloneLanguages.ts @@ -565,6 +565,7 @@ export function createMonacoLanguagesAPI(): typeof monaco.languages { CompletionItemKindModifier: standaloneEnums.CompletionItemKindModifier, CompletionItemInsertTextRule: standaloneEnums.CompletionItemInsertTextRule, SymbolKind: standaloneEnums.SymbolKind, + SymbolKindTag: standaloneEnums.SymbolKindTag, IndentAction: standaloneEnums.IndentAction, CompletionTriggerKind: standaloneEnums.CompletionTriggerKind, SignatureHelpTriggerKind: standaloneEnums.SignatureHelpTriggerKind, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 5cab18f9cff..1d2b95c1694 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -5232,10 +5232,15 @@ declare namespace monaco.languages { TypeParameter = 25 } + export enum SymbolKindTag { + Deprecated = 1 + } + export interface DocumentSymbol { name: string; detail: string; kind: SymbolKind; + kindTags: SymbolKindTag[]; containerName?: string; range: IRange; selectionRange: IRange; diff --git a/src/vs/workbench/api/common/extHostLanguageFeatures.ts b/src/vs/workbench/api/common/extHostLanguageFeatures.ts index 3954141c90a..a39d24d756a 100644 --- a/src/vs/workbench/api/common/extHostLanguageFeatures.ts +++ b/src/vs/workbench/api/common/extHostLanguageFeatures.ts @@ -70,6 +70,7 @@ class DocumentSymbolAdapter { const element = { name: info.name || '!!MISSING: name!!', kind: typeConvert.SymbolKind.from(info.kind), + kindTags: [], detail: undefined!, // Strict null override — avoid changing behavior containerName: info.containerName, range: typeConvert.Range.from(info.location.range), diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 1fdc6fef86f..0a3819ccd83 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -582,7 +582,8 @@ export namespace DocumentSymbol { detail: info.detail, range: Range.from(info.range), selectionRange: Range.from(info.selectionRange), - kind: SymbolKind.from(info.kind) + kind: SymbolKind.from(info.kind), + kindTags: [] }; if (info.children) { result.children = info.children.map(from);