mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 21:06:57 +00:00
Merge pull request #78092 from kamranayub/joh/completionsDeprecated
Strikeout deprecated CompletionItems
This commit is contained in:
commit
444783451b
8 changed files with 34 additions and 0 deletions
|
@ -396,6 +396,10 @@ export interface CompletionItem {
|
|||
* an icon is chosen by the editor.
|
||||
*/
|
||||
kind: CompletionItemKind;
|
||||
/**
|
||||
* Indicates if this item is deprecated.
|
||||
*/
|
||||
deprecated?: boolean;
|
||||
/**
|
||||
* A human-readable string with additional information
|
||||
* about this item, like type or symbol information.
|
||||
|
|
|
@ -97,6 +97,10 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.monaco-editor .suggest-widget-deprecated span {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
/** Icon styles **/
|
||||
|
||||
.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .header > .close,
|
||||
|
|
|
@ -60,6 +60,10 @@ export const editorSuggestWidgetForeground = registerColor('editorSuggestWidget.
|
|||
export const editorSuggestWidgetSelectedBackground = registerColor('editorSuggestWidget.selectedBackground', { dark: listFocusBackground, light: listFocusBackground, hc: listFocusBackground }, nls.localize('editorSuggestWidgetSelectedBackground', 'Background color of the selected entry in the suggest widget.'));
|
||||
export const editorSuggestWidgetHighlightForeground = registerColor('editorSuggestWidget.highlightForeground', { dark: listHighlightForeground, light: listHighlightForeground, hc: listHighlightForeground }, nls.localize('editorSuggestWidgetHighlightForeground', 'Color of the match highlights in the suggest widget.'));
|
||||
|
||||
/**
|
||||
* Suggest widget styles
|
||||
*/
|
||||
const editorSuggestWidgetDeprecatedClassName = 'suggest-widget-deprecated';
|
||||
|
||||
const colorRegExp = /^(#([\da-f]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))$/i;
|
||||
function extractColor(item: CompletionItem, out: string[]): boolean {
|
||||
|
@ -193,6 +197,10 @@ class Renderer implements IListRenderer<CompletionItem, ISuggestionTemplateData>
|
|||
];
|
||||
}
|
||||
|
||||
if (suggestion.label && suggestion.deprecated) {
|
||||
labelOptions.extraClasses = (labelOptions.extraClasses || []).concat([editorSuggestWidgetDeprecatedClassName]);
|
||||
}
|
||||
|
||||
data.iconLabel.setLabel(suggestion.label, undefined, labelOptions);
|
||||
data.typeLabel.textContent = (suggestion.detail || '').replace(/\n.*$/m, '');
|
||||
|
||||
|
|
4
src/vs/monaco.d.ts
vendored
4
src/vs/monaco.d.ts
vendored
|
@ -4814,6 +4814,10 @@ declare namespace monaco.languages {
|
|||
* an icon is chosen by the editor.
|
||||
*/
|
||||
kind: CompletionItemKind;
|
||||
/**
|
||||
* Indicates if this item is deprecated.
|
||||
*/
|
||||
deprecated?: boolean;
|
||||
/**
|
||||
* A human-readable string with additional information
|
||||
* about this item, like type or symbol information.
|
||||
|
|
11
src/vs/vscode.proposed.d.ts
vendored
11
src/vs/vscode.proposed.d.ts
vendored
|
@ -1141,4 +1141,15 @@ declare module 'vscode' {
|
|||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Deprecated support
|
||||
|
||||
export interface CompletionItem {
|
||||
/**
|
||||
* Indicates if this item is deprecated.
|
||||
*/
|
||||
deprecated?: boolean;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
|
|
@ -341,6 +341,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
|
|||
commitCharacters: data.k,
|
||||
additionalTextEdits: data.l,
|
||||
command: data.m,
|
||||
deprecated: data.n,
|
||||
// not-standard
|
||||
_id: data.x,
|
||||
};
|
||||
|
|
|
@ -934,6 +934,7 @@ export interface ISuggestDataDto {
|
|||
k/* commitCharacters */?: string[];
|
||||
l/* additionalTextEdits */?: ISingleEditOperation[];
|
||||
m/* command */?: modes.Command;
|
||||
n/* deprecated */?: boolean;
|
||||
// not-standard
|
||||
x?: ChainedCacheId;
|
||||
}
|
||||
|
|
|
@ -736,6 +736,7 @@ class SuggestAdapter {
|
|||
k: item.commitCharacters,
|
||||
l: item.additionalTextEdits && item.additionalTextEdits.map(typeConvert.TextEdit.from),
|
||||
m: this._commands.toInternal(item.command, disposables),
|
||||
n: item.deprecated
|
||||
};
|
||||
|
||||
// 'insertText'-logic
|
||||
|
|
Loading…
Reference in a new issue