feat(editor): split pane support for editor tabs#998
Conversation
Extends the existing terminal pane tree system to editor tabs so users can view different files side by side. - Cmd/Ctrl+D / Cmd/Ctrl+Shift+D split editor pane right / down - Cmd/Ctrl+[ / Cmd/Ctrl+] cycle focus between editor panes - Cmd/Ctrl+W with multiple panes closes the active pane only - Clicking a file in the explorer loads it into the focused split pane (falls back to new tab when the pane has unsaved changes) No existing behavior changed. Single-pane editor tabs and all terminal behavior are identical to before. New unit tests cover split, close, and focus-after-close tree transforms for editor pane trees (src/modules/tabs/lib/editorPanes.test.ts).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughEditor tabs now use pane trees with per-leaf paths, rendering, focus, dirty state, closing, splitting, file navigation, and editor command routing. Serialization, pane utilities, and workspace callback wiring were updated accordingly. ChangesEditor pane multiplexing
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/app/App.tsx`:
- Around line 558-573: Update the split-pane reuse condition in handleOpenFile
to require !pin alongside the existing editor, split, and clean-leaf checks.
Keep setLeafPath for preview opens only, allowing pinned or explicit opens to
continue through openFileTab.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 52d1be30-8655-40bd-9e2b-f04098f1db02
📒 Files selected for processing (12)
src/app/App.tsxsrc/app/components/WorkspaceSurface.tsxsrc/modules/command-palette/commands.tssrc/modules/editor/EditorPaneTreeView.tsxsrc/modules/editor/EditorStack.tsxsrc/modules/spaces/lib/serialize.test.tssrc/modules/spaces/lib/serialize.tssrc/modules/tabs/lib/editorPanes.test.tssrc/modules/tabs/lib/useTabs.tssrc/modules/terminal/index.tssrc/modules/terminal/lib/liveTerminals.test.tssrc/modules/terminal/lib/panes.ts
Register file associations for common text/source/config types so Terax appears in the OS "Open With" menu. Opening a file launches (or focuses) the app, opens the file in an editor tab, and sets its parent folder as the workspace. - tauri.conf.json: bundle.fileAssociations (role Editor) - lib.rs: accept a file launch arg (workspace = its parent); add LaunchFile state + get_launch_file command; handle macOS RunEvent::Opened (authorize parent, seed launch state, emit "terax:open-file") for warm start and the cold-start race - launchDir.ts: consumeLaunchFile() - App.tsx: drain get_launch_file + listen "terax:open-file" -> open file Register OS file associations so Terax appears in "Open With" for common text/source/config files. Opening a file opens it in an editor tab and makes its parent folder the workspace. Today Terax only accepts a **directory** launch argument — you can't hand it a file from the file manager. Closes crynta#979. - `tauri.conf.json`: `bundle.fileAssociations` (role `Editor`) for ~55 exts. - `src-tauri/src/lib.rs`: launch-arg parsing now accepts a file (workspace = parent dir); added `LaunchFile` state + `get_launch_file` command; added a macOS `RunEvent::Opened` handler — GUI launches deliver Open-With files via the Apple open-files event, not argv — which authorizes the parent, seeds the drain-once launch state, and emits `terax:open-file` (covers warm start and the cold-start race). - `src/lib/launchDir.ts`: `consumeLaunchFile()`. - `src/app/App.tsx`: mount effect drains `get_launch_file` and listens for `terax:open-file`, authorizes the parent, then opens the file. `openFileTab` dedupes by path, so double-delivery can't double-open. - `pnpm check-types` clean, `pnpm lint` clean, `pnpm test` clean. - `cargo clippy --all-targets --locked -- -D warnings` clean, `cargo nextest run` clean. - `pnpm tauri build`, launched via macOS Finder "Open With" and `open -a <file>`: app launches, opens the file, no crash. - [x] `pnpm lint` clean - [x] `pnpm check-types` clean - [x] `pnpm test` clean - [x] Manual smoke-test of the affected feature - [x] `cargo clippy --all-targets --locked -- -D warnings` clean - [x] `cargo nextest run --locked` clean - [x] Platforms tested: macOS - The macOS `Opened` handler also seeds `LaunchDir` so the workspace root follows the file's folder on cold start; residual race if `Opened` fires after the webview polls is mitigated by the emit + listener. - Linux/Windows **warm**-start ("Open With" into an already-running instance) needs `tauri-plugin-single-instance` — not added here. Cold-start via argv is wired but only manually tested on macOS. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * Added support for opening the app with a specific file (not just a folder). * Enhanced “Open With” handling on macOS to open the launched file directly. * Updated file associations so more text-based extensions open in Terax. * **Bug Fixes** * Improved warm-start and cold-start launch behavior to keep the correct file active. * Normalized Windows path separators for more reliable file-opening behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Extends the existing terminal pane tree system to editor tabs so users
can view different files side by side.
(falls back to new tab when the pane has unsaved changes)
No existing behavior changed. Single-pane editor tabs and all terminal
behavior are identical to before.
New unit tests cover split, close, and focus-after-close tree transforms
for editor pane trees (src/modules/tabs/lib/editorPanes.test.ts).
What
Editor tabs now support split panes, reusing the same
PaneNodetreeinfrastructure that already powers terminal splits. Each pane is
independent and can show a different file. A new
EditorPaneTreeViewcomponent (mirror of
PaneTreeView) handles recursive rendering withresizable panels.
Why
Addresses the "multiple editors side by side" use case from #533.
The pane tree system in
panes.tswas already generic with noterminal-specific logic, making this a natural extension.
How
path?toPaneNodeleaf and two new utilities (findLeafPath,setLeafPath) inpanes.tsEditorTabwithpaneTree: PaneNodeandactiveLeafIdsplitActivePane,closeActivePane,closePaneByLeaf,focusPane,focusNextPaneInTabinuseTabsto handle editor tabsalongside the unchanged terminal branches
EditorPaneTreeView.tsxmirroringPaneTreeView.tsxEditorStackto render via the pane tree instead of a flat mapTesting
pnpm lintcleanpnpm check-typescleanpnpm testclean (362 pass; pre-existingeager-budget.test.tssyntax failure is unrelated to this PR)
Screenshots / GIFs
Split pane in action — two files side by side after Ctrl+D then clicking
a second file in the explorer.
Notes for reviewer
untouched. The diff in
useTabs.tslooks large but each function'sterminal branch is identical to before — only an editor branch was
added after it.
path?field onPaneNodeleaf is optional and never set byterminal code, so existing terminal pane trees are unaffected.
preview: true) are intentionally excluded fromsplitting (same guard as terminal's
blocksflag).Closes #533 (partial — editor splits only; cross-type tiling is out of scope)
Summary by CodeRabbit
New Features
Bug Fixes
Tests