diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index f22125a6acb..3722d37916a 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -372,11 +372,9 @@ export let completionKindFromString: { export interface CompletionItemLabel { /** - * The label of this completion item. By default - * this is also the text that is inserted when selecting - * this completion. + * The name of this completion item's label. */ - label: string; + name: string; /** * A description of the completion item which is rendered diff --git a/src/vs/editor/contrib/suggest/completionModel.ts b/src/vs/editor/contrib/suggest/completionModel.ts index 5382be986e9..5013d8c1734 100644 --- a/src/vs/editor/contrib/suggest/completionModel.ts +++ b/src/vs/editor/contrib/suggest/completionModel.ts @@ -192,7 +192,7 @@ export class CompletionModel { } } - const label = typeof item.completion.label === 'string' ? item.completion.label : item.completion.label.label; + const label = typeof item.completion.label === 'string' ? item.completion.label : item.completion.label.name; if (wordPos >= wordLen) { // the wordPos at which scoring starts is the whole word // and therefore the same rules as not having a word apply diff --git a/src/vs/editor/contrib/suggest/suggest.ts b/src/vs/editor/contrib/suggest/suggest.ts index 61813788b10..c1f13090b28 100644 --- a/src/vs/editor/contrib/suggest/suggest.ts +++ b/src/vs/editor/contrib/suggest/suggest.ts @@ -59,7 +59,7 @@ export class CompletionItem { ) { this.textLabel = typeof completion.label === 'string' ? completion.label - : completion.label.label; + : completion.label.name; // ensure lower-variants (perf) this.labelLow = this.textLabel.toLowerCase(); @@ -191,7 +191,7 @@ export function provideSuggestionItems( } // fill in default sortText when missing if (!suggestion.sortText) { - suggestion.sortText = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.label; + suggestion.sortText = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name; } allSuggestions.push(new CompletionItem(position, suggestion, container, provider, model)); diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index b0fa140844a..8964cf24ecb 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -343,7 +343,7 @@ export class SuggestController implements IEditorContribution { } private _alertCompletionItem({ completion: suggestion }: CompletionItem): void { - const textLabel = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.label; + const textLabel = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name; if (isNonEmptyArray(suggestion.additionalTextEdits)) { let msg = nls.localize('arai.alert.snippet', "Accepting '{0}' made {1} additional edits", textLabel, suggestion.additionalTextEdits.length); alert(msg); diff --git a/src/vs/editor/contrib/suggest/suggestWidget.ts b/src/vs/editor/contrib/suggest/suggestWidget.ts index 90f1a7ba65d..aca32568984 100644 --- a/src/vs/editor/contrib/suggest/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/suggestWidget.ts @@ -69,7 +69,7 @@ const colorRegExp = /^(#([\da-f]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1 function extractColor(item: CompletionItem, out: string[]): boolean { const label = typeof item.completion.label === 'string' ? item.completion.label - : item.completion.label.label; + : item.completion.label.name; if (label.match(colorRegExp)) { out[0] = label; @@ -167,7 +167,7 @@ class Renderer implements IListRenderer renderElement(element: CompletionItem, _index: number, templateData: ISuggestionTemplateData): void { const data = templateData; const suggestion = (element).completion; - const textLabel = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.label; + const textLabel = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name; data.icon.className = 'icon ' + completionKindToCssClass(suggestion.kind); data.colorspan.style.backgroundColor = ''; @@ -630,7 +630,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate must have at least a label'); diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 19863726fac..97d0d97feb2 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -1352,7 +1352,7 @@ export enum CompletionItemTag { } export interface CompletionItemLabel { - label: string; + name: string; // description?: string; details?: string; }