From 2c7cb5cfc2cdece68892ef8941cb8bdddc52b2ef Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 20 Jan 2017 17:13:08 +0100 Subject: [PATCH] Settings search: Do not trust schema type instead check type of value to match search string --- .../parts/preferences/common/preferencesModels.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/parts/preferences/common/preferencesModels.ts b/src/vs/workbench/parts/preferences/common/preferencesModels.ts index 7407093690c..24e61fe659c 100644 --- a/src/vs/workbench/parts/preferences/common/preferencesModels.ts +++ b/src/vs/workbench/parts/preferences/common/preferencesModels.ts @@ -123,13 +123,11 @@ export abstract class AbstractSettingsModel extends Disposable { keyMatchingWords.set(word, keyMatches.map(match => this.toKeyRange(setting, match))); } - if (setting.value && (schema.type === 'string' || schema.enum)) { - const valueMatches = matchesContiguousSubString(word, setting.value); - if (valueMatches) { - valueMatchingWords.set(word, valueMatches.map(match => this.toValueRange(setting, match))); - } else if (schema.enum && schema.enum.some(enumValue => enumValue && !!matchesContiguousSubString(word, enumValue))) { - valueMatchingWords.set(word, []); - } + const valueMatches = typeof setting.value === 'string' ? matchesContiguousSubString(word, setting.value) : null; + if (valueMatches) { + valueMatchingWords.set(word, valueMatches.map(match => this.toValueRange(setting, match))); + } else if (schema.enum && schema.enum.some(enumValue => typeof enumValue === 'string' && !!matchesContiguousSubString(word, enumValue))) { + valueMatchingWords.set(word, []); } } -- GitLab