提交 b680dbb3 编写于 作者: J Johannes Rieken

debt - remove ISuggestSupport#filter

上级 6e555d38
......@@ -7,7 +7,6 @@
import { MarkedString } from 'vs/base/common/htmlContent';
import { IDisposable } from 'vs/base/common/lifecycle';
import URI from 'vs/base/common/uri';
import { IFilter } from 'vs/base/common/filters';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { TokenizationResult, TokenizationResult2 } from 'vs/editor/common/core/token';
import LanguageFeatureRegistry from 'vs/editor/common/modes/languageFeatureRegistry';
......@@ -237,8 +236,6 @@ export interface ISuggestSupport {
triggerCharacters: string[];
filter?: IFilter;
provideCompletionItems(model: editorCommon.IReadOnlyModel, position: Position, token: CancellationToken): ISuggestResult | Thenable<ISuggestResult>;
resolveCompletionItem?(model: editorCommon.IReadOnlyModel, position: Position, item: ISuggestion, token: CancellationToken): ISuggestion | Thenable<ISuggestion>;
......
......@@ -110,8 +110,7 @@ export class CompletionModel {
for (const item of this._items) {
const {suggestion, support, container} = item;
const filter = support && support.filter || fuzzyContiguousFilter;
const {suggestion, container} = item;
// collect those supports that signaled having
// an incomplete result
......@@ -128,17 +127,17 @@ export class CompletionModel {
let match = false;
// compute highlights based on 'label'
item.highlights = filter(word, suggestion.label);
item.highlights = fuzzyContiguousFilter(word, suggestion.label);
match = item.highlights !== null;
// no match on label nor codeSnippet -> check on filterText
if (!match && typeof suggestion.filterText === 'string') {
if (!isFalsyOrEmpty(filter(word, suggestion.filterText))) {
if (!isFalsyOrEmpty(fuzzyContiguousFilter(word, suggestion.filterText))) {
match = true;
// try to compute highlights by stripping none-word
// characters from the end of the string
item.highlights = filter(word.replace(/^\W+|\W+$/, ''), suggestion.label);
item.highlights = fuzzyContiguousFilter(word.replace(/^\W+|\W+$/, ''), suggestion.label);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册