mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-26 10:16:01 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user