Skip to content

fix(code-nav): stop excluding source packages named vendor/target/build (#1558) - #1559

Open
backnotprop wants to merge 2 commits into
mainfrom
fix/1558-code-nav-vendor-segment
Open

backnotprop wants to merge 2 commits into
mainfrom
fix/1558-code-nav-vendor-segment

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Closes #1558.

Code navigation (Cmd/Ctrl+click References and the token hover card) reported "No results" for first-party Java source whose package path contains a directory named vendor, e.g. src/main/java/com/example/vendor/app/.

A ripgrep glob with no slash matches a path segment at any depth, so --glob !vendor pruned the whole package subtree. The same trap applied to target (Maven's build dir, but also an ordinary package segment) and to build / dist / coverage.

Change

CODE_NAV_IGNORED_GLOBS in packages/shared/code-nav.ts is split in two:

  • Always ignored, any depth (unanchored): node_modules, .git, .next, __pycache__, .turbo, .cache, .venv, .pytest_cache — these can only ever be tool output.
  • Root only (anchored, --glob !/vendor): vendor, target, build, dist, coverage. Nested copies that really are build output are already skipped by ripgrep's default .gitignore handling.

Belt and braces: a segment the request's own filePath lives under is never excluded for that request, so a symbol in a changed file can always find its siblings.

The module is vendored to Pi by apps/pi-extension/vendor.sh, so both runtimes get the fix.

Behavior change

Nested vendor/ / target/ / build/ / dist/ / coverage/ directories that are not gitignored are now searched by code navigation. Root-level ones, and gitignored ones anywhere, are still skipped.

Verification

  • bun run typecheck (runs vendor.sh first) — clean
  • bun test packages/shared/code-nav* — 129 pass
  • bun test packages/server — 841 pass, 1 skip
  • bun test apps/pi-extension — 280 pass

New tests cover the #1558 shape (a Java file under .../vendor/app/ is found), a root-level vendor/ still excluded, node_modules excluded at any depth, and the origin-file rule. The real-ripgrep tests use a temp-dir fixture and skip cleanly when rg is not on PATH.

No docs changes: neither apps/marketing nor AGENTS.md documents the exclusion list.

…ld (#1558)

A ripgrep glob with no slash matches a path segment at any depth, so
--glob !vendor pruned first-party Java packages such as
src/main/java/com/example/vendor/app/ and code navigation reported
'No results'.

Split the exclusion list: names that can only be tool output stay
excluded at any depth, while the ambiguous names (vendor, target,
build, dist, coverage) are now excluded only at the search root via an
anchored glob. Nested copies that really are build output are already
skipped by ripgrep's default .gitignore handling.

Belt and braces: a segment the request's own file lives under is never
excluded for that request, so a symbol in a changed file can always
find its siblings.
Unit tests for the anchored/unanchored glob split and the origin-file
rule, plus real-ripgrep coverage over a temp fixture (skipped cleanly
when rg is not on PATH).
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.

[Bug] Code navigation excludes Java packages containing vendor, causing empty References

1 participant