Skip to content

Commit

Permalink
Merge pull request #113837 from HaoboGu/HaoboGu/issue113404
Browse files Browse the repository at this point in the history
Add emojis and several more symbols as word separators, fix #113404
  • Loading branch information
jrieken authored Jan 11, 2021
2 parents 1551d1f + e3f5b3d commit e149bdb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/vs/base/common/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ function isSeparatorAtPos(value: string, index: number): boolean {
if (index < 0 || index >= value.length) {
return false;
}
const code = value.charCodeAt(index);
const code = value.codePointAt(index);
switch (code) {
case CharCode.Underline:
case CharCode.Dash:
Expand All @@ -479,8 +479,16 @@ function isSeparatorAtPos(value: string, index: number): boolean {
case CharCode.DoubleQuote:
case CharCode.Colon:
case CharCode.DollarSign:
case CharCode.LessThan:
case CharCode.OpenParen:
case CharCode.OpenSquareBracket:
return true;
case undefined:
return false;
default:
if (strings.isEmojiImprecise(code)) {
return true;
}
return false;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/vs/base/test/common/filters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ suite('Filters', () => {
assert.ok(Boolean(match));
});

test('Wrong highlight after emoji #113404', function () {
assertMatches('di', '✨div classname=""></div>', '✨^d^iv classname=""></div>', fuzzyScore);
assertMatches('di', 'adiv classname=""></div>', 'adiv classname=""></^d^iv>', fuzzyScore);
});

test('Suggestion is not highlighted #85826', function () {
assertMatches('SemanticTokens', 'SemanticTokensEdits', '^S^e^m^a^n^t^i^c^T^o^k^e^n^sEdits', fuzzyScore);
assertMatches('SemanticTokens', 'SemanticTokensEdits', '^S^e^m^a^n^t^i^c^T^o^k^e^n^sEdits', fuzzyScoreGracefulAggressive);
Expand Down

0 comments on commit e149bdb

Please sign in to comment.