boost fully covered matches, #41060

Comparing `const` with `constructor` and `const` should favor the latter.
Even tho both are prefix matches, the latter is a perfect match and that
should be accounted for.
This commit is contained in:
Johannes Rieken
2018-01-24 18:08:00 +01:00
parent 08d824f3ac
commit be07c3cc0a
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -576,7 +576,7 @@ export function fuzzyScore(pattern: string, word: string, patternMaxWhitespaceIg
_matchesCount = 0;
_topScore = -100;
_patternStartPos = patternStartPos;
_findAllMatches(patternLen, wordLen, 0, new LazyArray(), false);
_findAllMatches(patternLen, wordLen, patternLen === wordLen ? 1 : 0, new LazyArray(), false);
if (_matchesCount === 0) {
return undefined;
+4 -2
View File
@@ -393,11 +393,11 @@ suite('Filters', () => {
// issue #17836
// assertTopScore(fuzzyScore, 'TEdit', 1, 'TextEditorDecorationType', 'TextEdit', 'TextEditor');
assertTopScore(fuzzyScore, 'p', 0, 'parse', 'posix', 'pafdsa', 'path', 'p');
assertTopScore(fuzzyScore, 'p', 4, 'parse', 'posix', 'pafdsa', 'path', 'p');
assertTopScore(fuzzyScore, 'pa', 0, 'parse', 'pafdsa', 'path');
// issue #14583
assertTopScore(fuzzyScore, 'log', 3, 'HTMLOptGroupElement', 'ScrollLogicalPosition', 'SVGFEMorphologyElement', 'log');
assertTopScore(fuzzyScore, 'log', 3, 'HTMLOptGroupElement', 'ScrollLogicalPosition', 'SVGFEMorphologyElement', 'log', 'logger');
assertTopScore(fuzzyScore, 'e', 2, 'AbstractWorker', 'ActiveXObject', 'else');
// issue #14446
@@ -415,6 +415,8 @@ suite('Filters', () => {
assertTopScore(fuzzyScore, 'is', 0, 'isValidViewletId', 'import statement');
assertTopScore(fuzzyScore, 'title', 1, 'files.trimTrailingWhitespace', 'window.title');
assertTopScore(fuzzyScore, 'const', 1, 'constructor', 'const', 'cuOnstrul');
});
test('Unexpected suggestion scoring, #28791', function () {