Skip to content

Commit be5fa39

Browse files
committed
💄
1 parent 22dd958 commit be5fa39

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/vs/base/common/filters.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,20 @@ function _findAllMatches(patternPos: number, wordPos: number, total: number, mat
621621
matches.unshift(wordPos);
622622
lastMatched = true;
623623

624+
// count simple matches and boost a row of
625+
// simple matches when they yield in a
626+
// strong match.
624627
if (score === 1) {
625628
simpleMatchCount += 1;
629+
630+
if (patternPos === _patternStartPos) {
631+
// when the first match is a weak
632+
// match we discard it
633+
return undefined;
634+
}
635+
626636
} else {
637+
// boost
627638
total += 1 + (simpleMatchCount * (score - 1));
628639
simpleMatchCount = 0;
629640
}
@@ -633,11 +644,6 @@ function _findAllMatches(patternPos: number, wordPos: number, total: number, mat
633644
}
634645
}
635646

636-
if (_scores[1][matches[0] + 1] === 1) {
637-
// first match is weak
638-
return undefined;
639-
}
640-
641647
total -= wordPos >= 3 ? 9 : wordPos * 3; // late start penalty
642648

643649
_bucket.push([total, matches]);

0 commit comments

Comments
 (0)