mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 21:06:57 +00:00
fix #79558
This commit is contained in:
parent
7621355f7e
commit
acb6d62091
2 changed files with 10 additions and 1 deletions
|
@ -549,7 +549,7 @@ export function fuzzyScore(pattern: string, patternLow: string, patternPos: numb
|
|||
const patternStartPos = patternPos;
|
||||
const wordStartPos = wordPos;
|
||||
|
||||
// There will be a mach, fill in tables
|
||||
// There will be a match, fill in tables
|
||||
for (patternPos = patternStartPos + 1; patternPos <= patternLen; patternPos++) {
|
||||
|
||||
for (wordPos = 1; wordPos <= wordLen; wordPos++) {
|
||||
|
@ -573,6 +573,11 @@ export function fuzzyScore(pattern: string, patternLow: string, patternPos: numb
|
|||
} else {
|
||||
score = 5;
|
||||
}
|
||||
} else if (isSeparatorAtPos(wordLow, wordPos - 1) && (wordPos === 1 || !isSeparatorAtPos(wordLow, wordPos - 2))) {
|
||||
// hitting a separator: `. <-> foo.bar`
|
||||
// ^
|
||||
score = 5;
|
||||
|
||||
} else if (isSeparatorAtPos(wordLow, wordPos - 2) || isWhitespaceAtPos(wordLow, wordPos - 2)) {
|
||||
// post separator: `foo <-> bar_foo`
|
||||
// ^^^
|
||||
|
|
|
@ -366,6 +366,10 @@ suite('Filters', () => {
|
|||
assertMatches('f', ':foo', ':^foo', fuzzyScore);
|
||||
});
|
||||
|
||||
test('Separator only match should not be weak #79558', function () {
|
||||
assertMatches('.', 'foo.bar', 'foo^.bar', fuzzyScore);
|
||||
});
|
||||
|
||||
test('Cannot set property \'1\' of undefined, #26511', function () {
|
||||
let word = new Array<void>(123).join('a');
|
||||
let pattern = new Array<void>(120).join('a');
|
||||
|
|
Loading…
Reference in a new issue