Quick Open: open exact relative paths without a full workspace file search#325609
Open
stefankandic wants to merge 2 commits into
Open
Quick Open: open exact relative paths without a full workspace file search#325609stefankandic wants to merge 2 commits into
stefankandic wants to merge 2 commits into
Conversation
Author
|
@microsoft-github-policy-service agree |
…ce file search When a Quick Open query resolves to an existing file relative to a workspace folder, return it directly instead of waiting for the fuzzy file search over all workspace files. The search is still started up front, but a relative-path hit returns without awaiting it, so pasting a full path (e.g. from a diff or a merge conflict) opens instantly instead of waiting for a search over the entire workspace. Previously the relative-path lookup and the fuzzy search ran together via Promise.all and the result was awaited on both, so the picker always waited for the workspace search - slow in large repos - even when the pasted path already pinpointed a single file. Because the search is kept in flight, a query that does not resolve to a file pays no extra latency. This mirrors the existing fast path for absolute paths, which already returns the single stat hit and skips the search. Partial queries that do not resolve to a file (e.g. `src/foo`) still fall through to the fuzzy search unchanged. Behavior change: on an exact relative-path hit the picker now shows only that file instead of also merging in fuzzy matches.
bfa12f7 to
bf25ed4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Improves Quick Open file searching by returning exact relative-path matches immediately instead of waiting for the full workspace fuzzy search, with accompanying unit tests.
Changes:
- Refactors
AnythingQuickAccessProvider.doFileSearchto return exact relative-path hits early and only await fuzzy search as a fallback. - Adds unit tests validating early-return behavior for existing relative paths and fallback behavior for non-existing paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts | Changes file search flow to avoid blocking on fuzzy workspace search when an exact relative path resolves. |
| src/vs/workbench/test/browser/quickAccess.test.ts | Adds tests/mocks to verify the new early-return and fallback behaviors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #325607
When a Quick Open query resolves to an existing file relative to a workspace folder, return it directly instead of waiting for the fuzzy file search over all workspace files. Pasting a full path (e.g. from a diff or a git merge conflict) then opens instantly instead of waiting for a search over the entire workspace, which is slow in large monorepos.
The fuzzy search is still started up front, but the relative-path lookup (
getRelativePathFileResults) is awaited first and, on a hit,doFileSearchreturns without awaiting the search. Previously both ran together viaPromise.alland the result was awaited on both, so the picker always waited for the workspace search even when the pasted path already pinpointed a single file. Because the search is kept in flight rather than started only on a miss, a query that does not resolve to a file pays no extra latency (important for remote/virtual workspaces where eachstatis a round-trip).This mirrors the existing fast path for absolute paths, which already returns the single
stathit and skips the search(
getAbsolutePathFileResult). Partial queries that don't resolve to a file (e.g.src/foo) still fall through to the fuzzy search unchanged.Behavior change: on an exact relative-path hit the picker now shows only that file instead of also merging in fuzzy matches, consistent with how absolute paths already behave.
Added unit tests in
quickAccess.test.ts: one asserts that a relative-path hit returns even when the fuzzy search never resolves (i.e. it doesn't wait for it), and one asserts a non-existing relative path still falls back to the search.