Open the focused file surface in a terminal editor - #10039
Conversation
File preview and markdown surfaces get an "Open in Terminal Editor" header button and a Cmd+Ctrl+E shortcut that hands the file to $VISUAL/$EDITOR (falling back to vi) in a cmux terminal surface, so a TUI editor gets the PTY it needs. A GUI app process has none of the user's shell configuration, so the editor is resolved by an interactive shell once in the background and cached; opens then launch the absolute path with no shell in between, carrying the shell's PATH so the editor still finds the tools it spawns. The editor surface opens beside the file surface and closes when the editor exits, which needs a new command-exit policy: startup commands otherwise hold the PTY open so a failed remote command stays readable. That default is unchanged and pinned by a test. The file surface stays open, both so quitting the editor returns to it and because a child exit on a workspace's last panel collapses the workspace. Placement is configurable through fileEditor.terminalEditorPlacement. Dock-hosted previews hide the action, since the Dock owns no terminal-capable surface tree. Co-authored-by: Cursor <cursoragent@cursor.com>
|
To use Codex here, create a Codex account and connect to github. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (27)
📝 WalkthroughWalkthroughThe pull request adds terminal-editor support for file-preview and Markdown panels. It resolves shell editors, launches terminal surfaces with configurable placement and exit behavior, adds save-before-open handling, and wires the feature to toolbar buttons and ChangesTerminal editor integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Panel
participant TerminalEditorResolutionStore
participant Workspace
participant TerminalPanel
Panel->>TerminalEditorResolutionStore: Resolve terminal editor
Panel->>Workspace: Open selected file
Workspace->>TerminalPanel: Create terminal surface
Workspace->>TerminalPanel: Run editor command with PATH
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Warning |
File preview and markdown surfaces get an "Open in Terminal Editor" header button and a Cmd+Ctrl+E shortcut that hands the file to $VISUAL/$EDITOR (falling back to vi) in a cmux terminal surface, so a TUI editor gets the PTY it needs. A GUI app process has none of the user's shell configuration, so the editor is resolved by an interactive shell once in the background and cached; opens then launch the absolute path with no shell in between, carrying the shell's PATH so the editor still finds the tools it spawns.
The editor surface opens beside the file surface and closes when the editor exits, which needs a new command-exit policy: startup commands otherwise hold the PTY open so a failed remote command stays readable. That default is unchanged and pinned by a test. The file surface stays open, both so quitting the editor returns to it and because a child exit on a workspace's last panel collapses the workspace.
Placement is configurable through fileEditor.terminalEditorPlacement. Dock-hosted previews hide the action, since the Dock owns no terminal-capable surface tree.
Summary
Testing
Demo Video
For UI or behavior changes, include a short demo video (GitHub upload, Loom, or other direct link).
Review Trigger (Copy/Paste as PR comment)
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Add “Open in Terminal Editor” for file preview and markdown surfaces. Press Cmd+Ctrl+E or click the header button to open the file in
$VISUAL/$EDITOR(fallbackvi) in a terminal; the editor tab closes on exit and the file tab stays open.Cmd+Ctrl+Eon file preview and markdown surfaces.ResolvedTerminalEditor; subsequent opens launch the absolute path and carry the shell’sPATH(no shell startup).TerminalSurfaceCommandExitPolicywithcloseOnExitused for the editor; the default “wait after command” behavior for other startup commands is unchanged.fileEditor.terminalEditorPlacement(afterSourcedefault, orendOfTabStrip). Dock-hosted previews hide the action.Written for commit 82e0bd1. Summary will update on new commits.
Summary by CodeRabbit
Ctrl+Cmd+Eshortcut and Dock shortcut support.$VISUALor$EDITOR, withvias a fallback.