Skip to content

Quick Open: open exact relative paths without a full workspace file search#325609

Open
stefankandic wants to merge 2 commits into
microsoft:mainfrom
stefankandic:stefankandic/quickaccess-relative-path-fast-path
Open

Quick Open: open exact relative paths without a full workspace file search#325609
stefankandic wants to merge 2 commits into
microsoft:mainfrom
stefankandic:stefankandic/quickaccess-relative-path-fast-path

Conversation

@stefankandic

@stefankandic stefankandic commented Jul 13, 2026

Copy link
Copy Markdown

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, doFileSearch returns without awaiting the search. Previously both ran together via Promise.all and 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 each stat is a round-trip).

This mirrors the existing fast path for absolute paths, which already returns the single stat hit 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.

Copilot AI review requested due to automatic review settings July 13, 2026 13:12
@stefankandic

Copy link
Copy Markdown
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.
@stefankandic stefankandic force-pushed the stefankandic/quickaccess-relative-path-fast-path branch from bfa12f7 to bf25ed4 Compare July 13, 2026 13:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.doFileSearch to 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.

Comment thread src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts Outdated
Comment thread src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts Outdated
Comment thread src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts Outdated
Comment thread src/vs/workbench/test/browser/quickAccess.test.ts
Comment thread src/vs/workbench/test/browser/quickAccess.test.ts Outdated
Comment thread src/vs/workbench/test/browser/quickAccess.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quick Open is slow to open an exact relative path in large workspaces

3 participants