diff --git a/extensions/typescript-language-features/src/features/diagnostics.ts b/extensions/typescript-language-features/src/features/diagnostics.ts index 0fe5d8b4e67..aaf4becb8d8 100644 --- a/extensions/typescript-language-features/src/features/diagnostics.ts +++ b/extensions/typescript-language-features/src/features/diagnostics.ts @@ -155,7 +155,7 @@ export class DiagnosticsManager { return this._diagnostics.get(DiagnosticKind.Suggestion)!.get(file).filter(x => { if (!this._enableSuggestions) { // Still show unused - return x.customTags && x.customTags.indexOf(vscode.DiagnosticTag.Unnecessary) !== -1; + return x.tags && x.tags.indexOf(vscode.DiagnosticTag.Unnecessary) !== -1; } return true; }); diff --git a/extensions/typescript-language-features/src/languageProvider.ts b/extensions/typescript-language-features/src/languageProvider.ts index 0a3d0172187..a00f7e9a470 100644 --- a/extensions/typescript-language-features/src/languageProvider.ts +++ b/extensions/typescript-language-features/src/languageProvider.ts @@ -154,7 +154,7 @@ export default class LanguageProvider { const reportUnnecessary = config.get('showUnused', true); this.diagnosticsManager.diagnosticsReceived(diagnosticsKind, file, diagnostics.filter(diag => { if (!reportUnnecessary) { - diag.customTags = undefined; + diag.tags = undefined; if (diag.reportUnnecessary && diag.severity === vscode.DiagnosticSeverity.Hint) { return false; } diff --git a/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts b/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts index 8c5c4da7196..1ce28c148e5 100644 --- a/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts +++ b/extensions/typescript-language-features/src/typeScriptServiceClientHost.ts @@ -298,7 +298,7 @@ export default class TypeScriptServiceClientHost { }).filter((x: any) => !!x) as DiagnosticRelatedInformation[]; } if (diagnostic.reportsUnnecessary) { - converted.customTags = [DiagnosticTag.Unnecessary]; + converted.tags = [DiagnosticTag.Unnecessary]; } (converted as Diagnostic & { reportUnnecessary: any }).reportUnnecessary = diagnostic.reportsUnnecessary; return converted as Diagnostic & { reportUnnecessary: any }; diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index 33f0ebc9c1e..56a282da585 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -131,7 +131,7 @@ class ModelMarkerHandler { switch (marker.severity) { case MarkerSeverity.Hint: - if (marker.customTags && marker.customTags.indexOf(MarkerTag.Unnecessary) >= 0) { + if (marker.tags && marker.tags.indexOf(MarkerTag.Unnecessary) >= 0) { className = ClassName.EditorUnnecessaryDecoration; } else { className = ClassName.EditorHintDecoration; @@ -159,8 +159,8 @@ class ModelMarkerHandler { break; } - if (marker.customTags) { - if (marker.customTags.indexOf(MarkerTag.Unnecessary) !== -1) { + if (marker.tags) { + if (marker.tags.indexOf(MarkerTag.Unnecessary) !== -1) { inlineClassName = ClassName.EditorUnnecessaryInlineDecoration; } } diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 651cf9adcc6..05aad76b9ef 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1093,7 +1093,7 @@ declare namespace monaco.editor { endLineNumber: number; endColumn: number; relatedInformation?: IRelatedInformation[]; - customTags?: MarkerTag[]; + tags?: MarkerTag[]; } /** @@ -1109,7 +1109,7 @@ declare namespace monaco.editor { endLineNumber: number; endColumn: number; relatedInformation?: IRelatedInformation[]; - customTags?: MarkerTag[]; + tags?: MarkerTag[]; } /** diff --git a/src/vs/platform/markers/common/markerService.ts b/src/vs/platform/markers/common/markerService.ts index 8329796d9b6..63ad53958d6 100644 --- a/src/vs/platform/markers/common/markerService.ts +++ b/src/vs/platform/markers/common/markerService.ts @@ -184,7 +184,7 @@ export class MarkerService implements IMarkerService { message, source, startLineNumber, startColumn, endLineNumber, endColumn, relatedInformation, - customTags, + tags, } = data; if (!message) { @@ -210,7 +210,7 @@ export class MarkerService implements IMarkerService { endLineNumber, endColumn, relatedInformation, - customTags, + tags, }; } diff --git a/src/vs/platform/markers/common/markers.ts b/src/vs/platform/markers/common/markers.ts index 69f34f9400f..5e2a8a2f91f 100644 --- a/src/vs/platform/markers/common/markers.ts +++ b/src/vs/platform/markers/common/markers.ts @@ -87,7 +87,7 @@ export interface IMarkerData { endLineNumber: number; endColumn: number; relatedInformation?: IRelatedInformation[]; - customTags?: MarkerTag[]; + tags?: MarkerTag[]; } export interface IResourceMarker { @@ -107,7 +107,7 @@ export interface IMarker { endLineNumber: number; endColumn: number; relatedInformation?: IRelatedInformation[]; - customTags?: MarkerTag[]; + tags?: MarkerTag[]; } export interface MarkerStatistics { diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 6a06b5c3772..60f7435509c 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -3938,6 +3938,23 @@ declare module 'vscode' { constructor(location: Location, message: string); } + /** + * Additional metadata about the type of a diagnostic. + */ + export enum DiagnosticTag { + /** + * Unused or unnecessary code. + * + * Diagnostics with this tag are rendered faded out. The amount of fading + * is controlled by the `"editorUnnecessaryCode.opacity"` theme color. For + * example, `"editorUnnecessaryCode.opacity": "#000000c0" will render the + * code with 75% opacity. For high contrast themes, use the + * `"editorUnnecessaryCode.border"` the color to underline unnecessary code + * instead of fading it out. + */ + Unnecessary = 1, + } + /** * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects * are only valid in the scope of a file. @@ -3978,6 +3995,11 @@ declare module 'vscode' { */ relatedInformation?: DiagnosticRelatedInformation[]; + /** + * Additional metadata about the diagnostic. + */ + tags?: DiagnosticTag[]; + /** * Creates a new diagnostic object. * diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 3b73a996d6c..2a67cc28100 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -492,26 +492,6 @@ declare module 'vscode' { //#endregion - //#region mjbvz: Unused diagnostics - /** - * Additional metadata about the type of diagnostic. - */ - export enum DiagnosticTag { - /** - * Unused or unnecessary code. - */ - Unnecessary = 1, - } - - export interface Diagnostic { - /** - * Additional metadata about the type of the diagnostic. - */ - customTags?: DiagnosticTag[]; - } - - //#endregion - //#region mjbvz: File rename events export interface ResourceRenamedEvent { readonly oldResource: Uri; diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index f5988c930c8..9aed1474620 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -111,7 +111,7 @@ export namespace Diagnostic { code: String(value.code), severity: DiagnosticSeverity.from(value.severity), relatedInformation: value.relatedInformation && value.relatedInformation.map(DiagnosticRelatedInformation.from), - customTags: Array.isArray(value.customTags) ? value.customTags.map(DiagnosticTag.from) : undefined, + tags: Array.isArray(value.tags) ? value.tags.map(DiagnosticTag.from) : undefined, }; } } diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 1b7face6d5b..208a20e8b96 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -750,7 +750,7 @@ export class Diagnostic { code: string | number; severity: DiagnosticSeverity; relatedInformation: DiagnosticRelatedInformation[]; - customTags?: DiagnosticTag[]; + tags?: DiagnosticTag[]; constructor(range: Range, message: string, severity: DiagnosticSeverity = DiagnosticSeverity.Error) { this.range = range;