Skip to content

feat: search-based code navigation with peek view#711

Open
backnotprop wants to merge 8 commits into
mainfrom
feat/cr-smart-nav
Open

feat: search-based code navigation with peek view#711
backnotprop wants to merge 8 commits into
mainfrom
feat/cr-smart-nav

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Adds IDE-like code navigation to the review UI via ripgrep-powered symbol search
  • Cmd/Ctrl+click a token in a diff to find definitions and references across the repo
  • Results displayed in a VS Code-style peek panel (Dockview) below the diff: syntax-highlighted file preview on the left, grouped reference list on the right
  • Backend supports language-aware definition patterns for TypeScript/JavaScript, Python, Go, and Rust with generic fallback
  • Results ranked by proximity: same file, changed files, same directory, with test file demotion
  • Both Bun and Pi servers implement /api/code-nav/resolve and /api/code-nav/file endpoints with full parity
  • Graceful degradation when ripgrep is not installed

Closes #694

Test plan

  • Open a review with /plannotator-review in a repo with local changes
  • Cmd+click a token — peek panel appears below the diff with definitions and references
  • Click different references in the right pane — left preview scrolls to that location
  • Double-click an "in diff" result — main diff panel navigates to the file with gold line highlight
  • Cmd+click a new token while peek is open — panel updates with new results
  • Close peek panel via X button or Escape key — diff reclaims full height
  • Test in all-files view — Cmd+click works there too
  • Verify parity tests pass: bun test tests/parity/
  • Verify unit tests pass: bun test packages/shared/code-nav.test.ts

Add IDE-like code navigation to the review UI. Cmd/Ctrl+click a token
in a diff to find its definitions and references across the repo via
ripgrep, displayed in a VS Code-style peek panel below the diff.

Backend: bounded rg search with language-aware definition patterns
(TS/JS, Python, Go, Rust), ranked results (same file > changed files >
same directory), confidence labels, and graceful degradation when rg
is not installed. Both Bun and Pi servers implement the endpoints.

Frontend: Dockview peek panel with syntax-highlighted full-file preview
on the left and grouped reference list on the right. Clicking a
reference scrolls the preview; double-clicking an in-diff result
navigates to the file with a gold line flash.

Closes #694
Add missing spawn import, type the close callback parameter,
and use double-cast for parseBody → CodeNavRequest.
Without this, clicking a cached file while a fetch is in-flight
leaves isLoading stuck true — the spinner hides the preview.
Adds pn-token-nav class with thicker underline and pointer cursor
when hovering a token while holding the modifier key, signaling
the token is Cmd+clickable for code navigation.
Strip the in-diff badge, double-click-to-jump, highlightDiffLine
wiring, and onCodeNavGoToDiff from the peek panel. The peek view
is the primary interaction — jump-to-diff adds complexity without
clear value at this stage.
Delete unused highlightDiffLine.ts, remove codeNavChangedFiles
and codeNavActiveSide from context and App.tsx, drop stale
extractChangedFiles import.
Change the TS/JS method pattern from zero-or-more (*) to
one-or-more (+) declaration keywords, so plain calls like
startServer(config) are no longer misclassified as definitions.
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.

[FEATURE REQUEST] Code navigation based on AST

1 participant