diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts b/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts index 2e226c678b5..471d1713868 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts @@ -468,7 +468,7 @@ export class SettingMatches { const subSettingValueRanges: IRange[] = this.getRangesForWords(words, subSettingMatches.valueMatchingWords, [this.descriptionMatchingWords, this.keyMatchingWords, subSettingMatches.keyMatchingWords]); result.push(...descriptionRanges, ...keyRanges, ...subSettingKeyRanges, ...subSettingValueRanges); result.push(...subSettingMatches.matches); - this.refreshMatchType(descriptionRanges.length, keyRanges.length + subSettingKeyRanges.length, subSettingValueRanges.length); + this.refreshMatchType(keyRanges.length + subSettingKeyRanges.length); this.matchType |= subSettingMatches.matchType; } } @@ -533,13 +533,13 @@ export class SettingMatches { valueRanges = this.valuesMatcher(searchString, setting); } - this.refreshMatchType(descriptionRanges.length, keyRanges.length, valueRanges.length); + this.refreshMatchType(keyRanges.length); return [...descriptionRanges, ...keyRanges, ...valueRanges]; } private checkForWholeWordMatchType(singleWordQuery: string, lineToSearch: string) { // Trim excess ending characters off the query. - singleWordQuery = singleWordQuery.toLowerCase().trimEnd().replace(/[-\._]+$/, ''); + singleWordQuery = singleWordQuery.toLowerCase().replace(/[\s-\._]+$/, ''); lineToSearch = lineToSearch.toLowerCase(); const singleWordRegex = new RegExp(`\\b${singleWordQuery}\\b`); if (singleWordRegex.test(lineToSearch)) { @@ -547,16 +547,10 @@ export class SettingMatches { } } - private refreshMatchType(descriptionRangesLength: number, keyRangesLength: number, valueRangesLength: number) { - if (descriptionRangesLength) { - this.matchType |= SettingMatchType.DescriptionMatch; - } + private refreshMatchType(keyRangesLength: number) { if (keyRangesLength) { this.matchType |= SettingMatchType.KeyMatch; } - if (valueRangesLength) { - this.matchType |= SettingMatchType.ValueMatch; - } } private getRangesForWords(words: string[], from: Map, others: Map[]): IRange[] { diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index 5ad1fcb41af..ad9e480a9ea 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -118,13 +118,12 @@ export interface IFilterResult { /** * The ways a setting could match a query, * sorted in increasing order of relevance. + * For now, ignore description and value matches. */ export enum SettingMatchType { None = 0, - DescriptionMatch = 1 << 0, - ValueMatch = 1 << 1, - KeyMatch = 1 << 2, - WholeWordMatch = 1 << 3 + WholeWordMatch = 1 << 0, + KeyMatch = 1 << 1 } export interface ISettingMatch {