Skip to content

feat(editor): add a deterministic code explore mode - #426

Merged
fcoury merged 11 commits into
mainfrom
cursor/code-explore-5c4c
Nov 3, 2026
Merged

fcoury merged 11 commits into
mainfrom
cursor/code-explore-5c4c

Conversation

@fcoury

@fcoury fcoury commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Reading unfamiliar code needs a view that stays legible without asking a model anything. Code explore is that view: a cursor-following sidebar, dimming, and a review trail that never sends the buffer to a model. gd still asks the language server.

Explore demo

The recording uses the Tokyo Night theme and JetBrainsMono Nerd Font. Captions use Red's chord notation. The bottom row is review › variable › template before the definition jump, then struct › LaunchSpec with 2/2. Trail back and forward change that counter.

Location row inside a function, with the sidebar
Location row on the struct after the jump, with the trail counter
Explore sidebar

The sidebar is a docked column from the window's top row, with one │ on the editor edge (| when borders are ASCII). Explore is a bold title with the Neo-tree root icon (> when icons are not Nerd Font). Section headers are bold in sideBar.foreground. The Matches count is right-aligned on its header. The definition count stays beside the kind (review.rs:8 let 3).

The row above the status line is the cursor, not the jump history. Inside a function it is review › variable › template. On struct LaunchSpec; it is struct › LaunchSpec. Empty segments and a segment that repeats the one before it are left out, and the word explore is not used as a placeholder. Inside still says top of the file when no function encloses the cursor. When the trail has entries, that row ends with a muted counter such as 2/2.

Space e was the error list. That list is now Space D. Space E still toggles explore. After Space, e is the explore group. Which-key shows only the next key; the full chord is the popup title (Space e · keymaps), the command line, :keys, and the command palette.

Keys

Key Action
Space e e, Space E, :explore Open or close
Space e q Close
Space e f, Space e * Follow this name
Space e s Dim all but project calls and system-touching library calls
Space e d Go to definition
Space e t Go to the written type
Space e j / Space e k Next / previous match
Space e b / Space e n Trail back / forward
Space e r Re-read this file
Space e R, :explore index Index the project in the background
Space e p, :explore pr Index this review, or turn that scope off
Space e ? Open Keyboard shortcuts for these bindings
gd Still asks the language server

Next match walks one file order, so stepping into another function does not skip an occurrence. Trail back reopens an unnamed buffer. Review scope leaves a helper in an unchanged file dim. The index is tree-sitter, capped at 400 files, and SCIP files stay unread.

Space e R, Space e p, and :explore index / pr do not run the walk on the editor thread. The status line counts files (Indexing project · 12/400), then shows the summary. Starting an index while one is already running does nothing extra. A buffer larger than 48 KiB, including Space e r and the reparse after an edit, is parsed in the background as well.

docs/EXPLORE.md and docs/DESIGN.md describe the mode and the sidebar rules it follows.

How to Test

  1. Open a wide Rust file and press Space e e. The sidebar should open on the top row with one divider. Put the cursor on a name inside a function and press Space e f. The bottom row should read function › kind › name, with no counter, and Inside should name that function.
  2. Press Space e d. The row should stay on the definition (struct › Name for a struct) and gain a counter such as 2/2. Space e b should return to the use and show 1/2. Space e n should return to 2/2. On a top-level struct, Inside should say top of the file.
  3. Press Space e R, or :explore pr for the current review. Typing and scrolling should keep working while the status line counts files, then the summary should replace the count. Running the same command during the count should report that an index is already running.
  4. Regression: Space D should open the error list. With explore off, double-click should still select a word. cargo test --lib location_row_follows_the_cursor, cargo test --lib project_index_lets_the_editor_take_input_while_it_runs, and cargo test --lib large_buffer_reparse_does_not_block_the_next_edit cover the location row, a live index, and a large buffer.
Open in Web Open in Cursor 

@fcoury
fcoury marked this pull request as ready for review November 1, 2026 17:27
@fcoury

fcoury commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T23:16:57.187773Z a4481a0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4481a0d21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/explore/mod.rs Resolved
Comment thread src/editor/explore_ui.rs Resolved
Comment thread src/explore/mod.rs Resolved
@cursor
cursor Bot force-pushed the cursor/code-explore-5c4c branch from a4481a0 to 581f4a6 Compare November 1, 2026 23:19
fcoury added 11 commits November 3, 2026 14:59
Give Red a reading view for unfamiliar code: a cursor-following sidebar,
symbol follow, skeleton dimming, a review trail, and a tree-sitter index
that can refresh one file or only a pull request's changed files.
Write the interface rules the editor and plugins already follow, then bring
the explore sidebar in line with them: theme colors, a footer under the
content, ellipsis, keycaps, and plain labels.
Space e is the explore group, with plain labels in the which-key popup.
Errors move to Space D. Section headings use the theme accent, and a
single indexed file reads as "1 file".
Shell commands re-enter execute. Building the explore future in its own
non-inlined function matches the other boxed editor actions.
Drop the bracketed key list. Space e ? opens Keyboard shortcuts
scoped to the explore bindings. The sidebar uses the dialog frame
and sideBar styles, and counts and modes follow the status line.
Replace the dialog frame with a sideBar fill, one editor-edge divider,
and a plain explore title row.
Put Explore on the window-bar row, keep section names bold in the
content color, and right-align only the Matches count.
Keep the bottom row on the current function, kind, and name, and
add a muted trail counter only while jumps are recorded.
A detached shell command re-enters the action dispatcher. In a debug
build that function's frame is large enough that the nested call
overflows the 2 MiB test stack. Move the earlier match arms into their
own frame. Space D is the error list that stays available from a panel.
Next match walks a stable file order, so stepping into another function
does not skip occurrences. Trail jumps to an unnamed buffer activate
that buffer. Review scope no longer treats a helper in an unchanged
file as a project call.
Space e R walked the tree and parsed every file on the editor thread,
so Red's sources blocked input for about 11 seconds. The scan now runs
on a background thread, the status line counts files, and a second
command does not start another index. Large open buffers reparse off
the editor thread as well.
@cursor
cursor Bot force-pushed the cursor/code-explore-5c4c branch from ba43ef2 to 2949aa9 Compare November 3, 2026 15:13
@fcoury
fcoury merged commit 1548ed5 into main Nov 3, 2026
23 checks passed
@fcoury
fcoury deleted the cursor/code-explore-5c4c branch November 3, 2026 15:34
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.

1 participant