diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index ef1df9087413dd9e92fcf7d3b2bcd6c7cfd281b1..76bb974d5678b34bc8b39c2c2b288e7953b29957 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -119,6 +119,15 @@ function isWhitespace(code: number): boolean { ); } +const wordSeparators = new Set(); +'`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?' + .split('') + .forEach(s => wordSeparators.add(s.charCodeAt(0))); + +function isWordSeparator(code: number): boolean { + return wordSeparators.has(code); +} + function isAlphanumeric(code: number): boolean { return isLower(code) || isUpper(code) || isNumber(code); } @@ -308,7 +317,8 @@ function _matchesWords(word: string, target: string, i: number, j: number, conti function nextWord(word: string, start: number): number { for (let i = start; i < word.length; i++) { const c = word.charCodeAt(i); - if (isWhitespace(c) || (i > 0 && isWhitespace(word.charCodeAt(i - 1)))) { + if (isWhitespace(c) || (i > 0 && isWhitespace(word.charCodeAt(i - 1))) || + isWordSeparator(c) || (i > 0 && isWordSeparator(word.charCodeAt(i - 1)))) { return i; } }