Freeze mixed-file retrieval diagnostic and shared-engine evaluator
This commit is contained in:
1 parent
bba34de7aa
commit
6a5a2dc40d
20 files changed
+7597
No files matched your search
@@ -0,0 +1,24 @@
|
||||
/** Preserve the user's result choice while progressive indexing hides it briefly. */
|
||||
export class ResultSelection {
|
||||
private scope: string | null = null;
|
||||
private intendedPath: string | null = null;
|
||||
|
||||
begin(scope: string) {
|
||||
if (scope !== this.scope) {
|
||||
this.scope = scope;
|
||||
this.intendedPath = null;
|
||||
}
|
||||
}
|
||||
|
||||
choose(path: string) {
|
||||
this.intendedPath = path;
|
||||
}
|
||||
|
||||
resolve(paths: readonly string[]): number {
|
||||
if (!paths.length) return -1;
|
||||
if (this.intendedPath === null) this.intendedPath = paths[0];
|
||||
const intended = paths.indexOf(this.intendedPath);
|
||||
// A temporary fallback is presentation, not a new user choice.
|
||||
return intended >= 0 ? intended : 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user