5.3 KiB
5.3 KiB
Quick Open Gitignored Files
Problem
Cmd/Ctrl+P Quick Open does not list arbitrary gitignored files in the active workspace.
src/renderer/src/components/QuickOpen.tsx:257callswindow.api.fs.listFiles(...); filtering in the renderer only fuzzy-matches the returned list, so missing files are already absent from the backend result.src/main/ipc/filesystem-list-files.ts:46usesbuildRgArgsForQuickOpen(...)for local worktrees, then merges the primary rg pass withenvPass.src/relay/fs-handler-list-files.ts:37uses the same shared rg args for SSH worktrees.src/shared/quick-open-filter.ts:252builds the primary rg pass without--no-ignore-vcs, so gitignored files are hidden.src/shared/quick-open-filter.ts:265builds a second--no-ignore-vcspass, but it is restricted to.env*and**/.env*.src/shared/quick-open-filter.ts:357builds the git fallback primary pass with--exclude-standard;src/shared/quick-open-filter.ts:365only adds.env*pathspecs.
Root Cause
Quick Open intentionally mirrors rg --files --hidden with gitignore respect, then adds a special-case pass for gitignored .env* files. That policy lives in shared code used by local main-process listing, SSH relay listing, and git fallback listing, so non-env ignored files are excluded consistently in every workspace type.
Non-goals
- Do not change right-sidebar text search behavior.
- Do not add a new UI preference or mode switch.
- Do not follow symlinks or broaden traversal outside the authorized workspace root.
- Do not surface heavy generated directories already excluded by Quick Open policy, including
node_modules,.git,.cache,.next, and otherHIDDEN_DIR_BLOCKLISTentries. - Do not change fuzzy ranking, selection, file-opening behavior, or shortcut handling.
Design
-
Replace the
.env*rg second pass with a general ignored-files pass.- Keep
--files --hidden --no-ignore-vcs, hidden-dir blocklist globs, nested-worktree exclude globs,searchRoot='.', and path-separator handling. - Remove positive
.env*globs so the second pass is no longer a whitelist. - Keep the primary pass unchanged.
- Keep
-
Rename pass naming from
envPasstoignoredPassin shared/main/relay code.- This is a behavior change, not cosmetic: the second pass now returns all gitignored candidates.
-
Replace git fallback
.env*pass with ignored-files pass.- Keep primary as
['--cached', '--others', '--exclude-standard', ...]. - Use ignored pass as
['--others', '--ignored', '--exclude-standard', ...]. - Keep nested-worktree pathspec exclusion semantics (
--,., excludes when exclude prefixes exist). - Do not assume both runtimes have identical error semantics today:
- local main fallback currently resolves on most git failures;
- relay fallback rejects on spawn/signal failures. Preserve each runtime’s current behavior unless explicitly changing it in a separate doc.
- Keep primary as
-
Keep post-filters unchanged.
shouldIncludeQuickOpenPathremains final blocklist enforcement.shouldExcludeQuickOpenRelPathremains nested-worktree correctness backstop.- Set-based merge still dedupes cross-pass overlap.
-
Do not change renderer request-lifecycle logic in this doc.
- Current
QuickOpen.tsxeffect cleanup cancels the prior request before the next effect body runs. - This change is backend listing policy only.
- Current
-
Update tests.
quick-open-filter.test.ts: assert rg ignored pass has--no-ignore-vcsand no.env*globs; assert git ignored pass has--others --ignored --exclude-standardand no.env*pathspec whitelist.filesystem-list-files.test.ts: update pass-detection helpers that currently key off'**/.env*'; cover ignored non-env files; keep local fallback’s resolve-on-failure behavior unchanged.- Add relay coverage in
src/relay/fs-handler.test.ts(or new focused relay tests) for ignored-pass args and current reject-on-signal behavior.
Edge Cases
- Gitignored files inside
node_modules,.git,.cache,.next,.npm,.npm-global,.gvfs, and other blocklisted dirs must remain hidden. - Nested linked worktree paths passed as
excludePathsmust remain excluded from both rg and git passes. - Local/SSH candidate sets should match when both run the same backend path (rg or git) and complete successfully; timeout/error behavior remains intentionally different today.
- Windows and WSL path normalization must remain unchanged; output still passes through
normalizeQuickOpenRgLine. - If rg is unavailable, git fallback should include ignored files only when Git can enumerate them; non-git roots keep existing fallback limits.
- Timeout/signal behavior must not regress into partial false-empty results.
- Keep existing timeout asymmetry unless intentionally changed: local rg/git fallback uses 10s timeouts, relay rg uses 25s.
--no-ignore-vcsalso includes files ignored by parent/global excludes; blocklists are the guardrail against accidental heavy trees.
Rollout
- Update
src/shared/quick-open-filter.tstypes, rg args, git args, and comments. - Update local main-process and SSH relay callers/tests for
ignoredPass. - Run focused tests for quick-open filters and list-files (main + relay).
- Run
pnpm typecheckandpnpm lint. - Validate in Electron on local + SSH worktrees with gitignored non-env files and nested linked worktrees.