提交 7803c1d4 编写于 作者: P Pine Wu

Cleanup

上级 86218b28
......@@ -192,7 +192,7 @@ export class CompletionModel {
}
}
const label = typeof item.completion.label === 'string' ? item.completion.label : item.completion.label.name;
const textLabel = 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
......@@ -207,19 +207,19 @@ export class CompletionModel {
if (!match) {
continue; // NO match
}
if (compareIgnoreCase(item.completion.filterText, label) === 0) {
if (compareIgnoreCase(item.completion.filterText, textLabel) === 0) {
// filterText and label are actually the same -> use good highlights
item.score = match;
} else {
// re-run the scorer on the label in the hope of a result BUT use the rank
// of the filterText-match
item.score = anyScore(word, wordLow, wordPos, label, item.labelLow, 0);
item.score = anyScore(word, wordLow, wordPos, textLabel, item.labelLow, 0);
item.score[0] = match[0]; // use score from filterText
}
} else {
// by default match `word` against the `label`
let match = scoreFn(word, wordLow, wordPos, label, item.labelLow, 0, false);
let match = scoreFn(word, wordLow, wordPos, textLabel, item.labelLow, 0, false);
if (!match) {
continue; // NO match
}
......
......@@ -654,26 +654,6 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.editor.focus();
}
private _getSuggestionAriaAlertLabel(item: CompletionItem): string {
const textLabel = typeof item.completion.label === 'string' ? item.completion.label : item.completion.label.name;
if (this.expandDocsSettingFromStorage()) {
return nls.localize('ariaCurrenttSuggestionReadDetails', "Item {0}, docs: {1}", textLabel, this.details.getAriaLabel());
} else {
return textLabel;
}
}
private _lastAriaAlertLabel: string | null = null;
private _ariaAlert(newAriaAlertLabel: string | null): void {
if (this._lastAriaAlertLabel === newAriaAlertLabel) {
return;
}
this._lastAriaAlertLabel = newAriaAlertLabel;
if (this._lastAriaAlertLabel) {
alert(this._lastAriaAlertLabel, true);
}
}
private onThemeChange(theme: ITheme) {
const backgroundColor = theme.getColor(editorSuggestWidgetBackground);
if (backgroundColor) {
......
......@@ -48,10 +48,7 @@ export abstract class WordDistance {
if (suggestion.kind === CompletionItemKind.Keyword) {
return 2 << 20;
}
let word = typeof suggestion.label === 'string'
? suggestion.label
: suggestion.label.name;
let word = typeof suggestion.label === 'string' ? suggestion.label : suggestion.label.name;
let wordLines = wordRanges[word];
if (isFalsyOrEmpty(wordLines)) {
return 2 << 20;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册