Skip to content

Commit a02cfef

Browse files
author
Benjamin Pasero
committed
quick access - treat slash and backslash equal (fix microsoft#94871)
1 parent 4db9f2c commit a02cfef

2 files changed

Lines changed: 158 additions & 104 deletions

File tree

src/vs/base/common/fuzzyScorer.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function doScoreFuzzy(query: string, queryLower: string, queryLength: number, ta
161161
function computeCharScore(queryCharAtIndex: string, queryLowerCharAtIndex: string, target: string, targetLower: string, targetIndex: number, matchesSequenceLength: number): number {
162162
let score = 0;
163163

164-
if (queryLowerCharAtIndex !== targetLower[targetIndex]) {
164+
if (!considerAsEqual(queryLowerCharAtIndex, targetLower[targetIndex])) {
165165
return score; // no match of characters
166166
}
167167

@@ -228,6 +228,19 @@ function computeCharScore(queryCharAtIndex: string, queryLowerCharAtIndex: strin
228228
return score;
229229
}
230230

231+
function considerAsEqual(a: string, b: string): boolean {
232+
if (a === b) {
233+
return true;
234+
}
235+
236+
// Special case path spearators: ignore platform differences
237+
if (a === '/' || a === '\\') {
238+
return b === '/' || b === '\\';
239+
}
240+
241+
return false;
242+
}
243+
231244
function scoreSeparatorAtPos(charCode: number): number {
232245
switch (charCode) {
233246
case CharCode.Slash:

0 commit comments

Comments
 (0)