Skip to content

Commit ff4c795

Browse files
author
Benjamin Pasero
committed
Quick open: cannot search for tilde anymore (fix microsoft#99031)
1 parent cb23f87 commit ff4c795

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -491,22 +491,34 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
491491
// Use absolute path result as only results if present
492492
let fileMatches: Array<URI>;
493493
if (absolutePathResult) {
494-
fileMatches = [absolutePathResult];
494+
if (excludes.has(absolutePathResult)) {
495+
return []; // excluded
496+
}
497+
498+
// Create a single result pick and make sure to apply full
499+
// highlights to ensure the pick is displayed. Since a
500+
// ~ might have been used for searching, our fuzzy scorer
501+
// may otherwise not properly respect the pick as a result
502+
const absolutePathPick = this.createAnythingPick(absolutePathResult, this.configuration);
503+
absolutePathPick.highlights = {
504+
label: [{ start: 0, end: absolutePathPick.label.length }],
505+
description: absolutePathPick.description ? [{ start: 0, end: absolutePathPick.description.length }] : undefined
506+
};
507+
508+
return [absolutePathPick];
495509
}
496510

497511
// Otherwise run the file search (with a delayer if cache is not ready yet)
498-
else {
499-
if (this.pickState.fileQueryCache?.isLoaded) {
500-
fileMatches = await this.doFileSearch(query, token);
501-
} else {
502-
fileMatches = await this.fileQueryDelayer.trigger(async () => {
503-
if (token.isCancellationRequested) {
504-
return [];
505-
}
512+
if (this.pickState.fileQueryCache?.isLoaded) {
513+
fileMatches = await this.doFileSearch(query, token);
514+
} else {
515+
fileMatches = await this.fileQueryDelayer.trigger(async () => {
516+
if (token.isCancellationRequested) {
517+
return [];
518+
}
506519

507-
return this.doFileSearch(query, token);
508-
});
509-
}
520+
return this.doFileSearch(query, token);
521+
});
510522
}
511523

512524
if (token.isCancellationRequested) {

0 commit comments

Comments
 (0)