diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index 9f85a2e34d024eac8cd5286e5abb7d11ca65538b..6592e10209d531a84e3e01bbdc5cd3585435132e 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -343,8 +343,12 @@ export function matchesFuzzy(word: string, wordToMatchAgainst: string, enableSep return enableSeparateSubstringMatching ? fuzzySeparateFilter(word, wordToMatchAgainst) : fuzzyContiguousFilter(word, wordToMatchAgainst); } -export function matchesFuzzy2(word: string, wordToMatchAgainst: string): IMatch[] | null { - let score = fuzzyScore(word, word.toLowerCase(), 0, wordToMatchAgainst, wordToMatchAgainst.toLowerCase(), 0, false); +/** + * Match pattern againt word in a fuzzy way. As in IntelliSense and faster and more + * powerfull than `matchesFuzzy` + */ +export function matchesFuzzy2(pattern: string, word: string): IMatch[] | null { + let score = fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0, false); return score ? createMatches(score) : null; } diff --git a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts index 32102b7988f107e5e196d6530d1d8f24ece01ea2..5ef1f1673d1ba5bab306c5212aa5bb69d6730dd4 100644 --- a/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts @@ -89,7 +89,7 @@ class OutlineModel extends QuickOpenModel { // Filter by search if (normalizedSearchValue) { - const highlights = filters.matchesFuzzy(normalizedSearchValue, entry.getLabel()); + const highlights = filters.matchesFuzzy2(normalizedSearchValue, entry.getLabel()); if (highlights) { entry.setHighlights(highlights); entry.setHidden(false); diff --git a/src/vs/workbench/parts/search/browser/openSymbolHandler.ts b/src/vs/workbench/parts/search/browser/openSymbolHandler.ts index 0dc2fba92fe7252dcbfc4b1a039f98db59ff920f..d9261996f532da210fe92fe9741514e7699f4324 100644 --- a/src/vs/workbench/parts/search/browser/openSymbolHandler.ts +++ b/src/vs/workbench/parts/search/browser/openSymbolHandler.ts @@ -206,7 +206,7 @@ export class OpenSymbolHandler extends QuickOpenHandler { } const entry = this.instantiationService.createInstance(SymbolEntry, element, provider); - entry.setHighlights(filters.matchesFuzzy(searchValue, entry.getLabel())); + entry.setHighlights(filters.matchesFuzzy2(searchValue, entry.getLabel())); bucket.push(entry); } }