Repository navigation
Add code editor surface type - #4801
austinywang wants to merge 24 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Need the big picture first? Review this PR in Change Stack to see what changed before going file by file. 📝 WalkthroughWalkthroughThis PR adds a new Code Editor panel type alongside Browser and Terminal, enabling users to open inline VSCode surfaces with full session restoration, split management, and UI integration through a centralized ChangesCode Editor Panel Type and Integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (2 errors, 1 warning)
✅ Passed checks (16 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
…cursor-like-code-editor-as-a
Greptile SummaryAdds
Confidence Score: 5/5Safe to merge. All creation paths, session/config restore, lifecycle events, and scoped browser behaviors are consistently handled, and the previously-identified issues were resolved in follow-up commits. The surface-role gating is encapsulated in BrowserPanel.SurfaceRole, so every call site reads a single predicate. The provisional-panel discard logic is sound because currentURL is set eagerly at init from the default URL. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as User
participant AD as AppDelegate.openCodeEditor
participant TM as TabManager
participant WS as Workspace
participant BP as BrowserPanel
participant SWC as VSCodeServeWebController
UI->>AD: open code editor
AD->>TM: openCodeEditor(inWorkspace:url:vscode.dev)
TM->>WS: newBrowserSurface(surfaceRole:.codeEditor)
WS->>BP: init(surfaceRole:.codeEditor)
BP-->>AD: panelId returned immediately
AD-->>UI: panelId
AD->>SWC: await ensureServeWebURL
SWC-->>AD: serveWebURL or nil
alt resolved
AD->>BP: navigate(to: openFolderURL)
else failed
AD->>WS: discardProvisionalDefaultCodeEditor
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant UI as User
participant AD as AppDelegate.openCodeEditor
participant TM as TabManager
participant WS as Workspace
participant BP as BrowserPanel
participant SWC as VSCodeServeWebController
UI->>AD: open code editor
AD->>TM: openCodeEditor(inWorkspace:url:vscode.dev)
TM->>WS: newBrowserSurface(surfaceRole:.codeEditor)
WS->>BP: init(surfaceRole:.codeEditor)
BP-->>AD: panelId returned immediately
AD-->>UI: panelId
AD->>SWC: await ensureServeWebURL
SWC-->>AD: serveWebURL or nil
alt resolved
AD->>BP: navigate(to: openFolderURL)
else failed
AD->>WS: discardProvisionalDefaultCodeEditor
end
Reviews (12): Last reviewed commit: "fix: use raw surface kind for editor tab..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e2304d0. Configure here.
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 `@Sources/Panels/BrowserPanel.swift`:
- Around line 3106-3161: The init for BrowserPanel should honor SurfaceRole
defaults instead of leaving values to callers: in BrowserPanel.init, initialize
the panel's initialURL from SurfaceRole.defaultInitialURL (use that when role ==
.codeEditor) and set omnibarVisible based on SurfaceRole.showsBrowserChrome
(hide omnibar when showsBrowserChrome is false), and ensure any other
role-dependent flags (e.g., recordsBrowserHistory,
contributesToBrowserOpenTabSuggestions, contributesToGlobalBrowserSearch) derive
from the SurfaceRole properties so code-editor panes get the authoritative
defaults; update the initializer paths that currently default initialURL = nil
or omnibarVisible = true to pull from the SurfaceRole instance.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: f9425d37-6638-4106-92cb-fd09e1c7302a
📒 Files selected for processing (31)
Examples/SampleSidebarExtensionApp/SampleSidebarExtension/Model/SidebarInsightModel.swiftExamples/TabsVisibleSidebar/TabsVisibleSidebarExtension/TabsVisibleSidebarView.swiftPackages/CmuxExtensionKit/Sources/CmuxExtensionKit/Sidebar/CMUXSidebarSurface.swiftResources/Localizable.xcstringsSources/AppDelegate.swiftSources/ClosedItemHistory.swiftSources/CmuxConfig.swiftSources/CmuxLifecycleEventPublishing.swiftSources/CmuxSurfaceTabBarBuiltInAction.swiftSources/ContentView.swiftSources/KeyboardShortcutContext.swiftSources/Panels/BrowserOmnibarPerformanceSupport.swiftSources/Panels/BrowserPanel.swiftSources/Panels/BrowserPanelView.swiftSources/Panels/Panel.swiftSources/Panels/PanelContentView.swiftSources/Search/GlobalSearchDocuments.swiftSources/Search/GlobalSearchPanelCaptureManager.swiftSources/TabManager.swiftSources/TaskManagerSnapshot.swiftSources/TaskManagerTypes.swiftSources/TerminalController.swiftSources/TerminalControllerV2ParamParsingSupport.swiftSources/TerminalPaneDropTargetView.swiftSources/Workspace.swiftSources/WorkspaceContentView.swiftSources/cmuxApp.swiftcmuxTests/AppDelegateIssue2907RoutingTests.swiftcmuxTests/TabManagerSessionSnapshotTests.swiftcmuxTests/TabManagerUnitTests.swiftcmuxTests/WorkspaceUnitTests.swift
|
@coderabbitai review |
✅ Action performedReview finished.
|
Resolved by 09e7889; the CodeRabbit thread is resolved and CodeRabbit confirmed it addressed, but the follow-up review only submitted COMMENTED, leaving a stale CHANGES_REQUESTED review.
…cursor-like-code-editor-as-a # Conflicts: # Packages/CmuxExtensionKit/Sources/CmuxExtensionKit/Sidebar/CMUXSidebarSurface.swift # Resources/Localizable.xcstrings # Sources/Panels/Panel.swift # Sources/Search/GlobalSearchDocuments.swift # Sources/TerminalController.swift # Sources/TerminalControllerV2ParamParsingSupport.swift # Sources/Workspace.swift # Sources/cmuxApp.swift
…cursor-like-code-editor-as-a
…cursor-like-code-editor-as-a

Summary
editor/code editor surface type backed by the existing WebKit browser panel lifecycle.Closes #648
Verification
node -e 'JSON.parse(require("fs").readFileSync("Resources/Localizable.xcstrings", "utf8")); console.log("Localizable.xcstrings valid JSON")'plutil -convert json -o /dev/null Resources/Localizable.xcstringsgit diff --checkLocal builds and tests were not run per HQ instruction. HQ build command:
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Note
Medium Risk
Touches core panel/workspace lifecycle, session restore, and automation APIs across a wide surface area, though behavior is gated by explicit surface roles rather than changing terminal/browser defaults.
Overview
Introduces a first-class Code Editor surface (
editor/codeEditor) that reuses the WebKitBrowserPanelstack via a newSurfaceRole.codeEditor, defaulting tohttps://vscode.devand hiding browser chrome.Creation and routing: New
openCodeEditor/TabManager.openCodeEditorpaths wire File menu, command palette, empty-pane actions, surface tab bar (cmux.newCodeEditor), splits, and inline “open folder in VS Code” to code-editor panels instead of generic browsers. Folder opens resolve serve-web URLs asynchronously (ensureServeWebURL); provisional default tabs can be discarded if folder navigation never lands.Scoped browser behavior: Code editor panels skip omnibar, browser history, open-tab suggestions, global browser search, and
focusedBrowserPanel(browser-only shortcuts). Keyboard/shortcut and omnibar code paths filter onpanelType == .browserwhere needed.Platform parity:
PanelType, config (CmuxSurfaceType), session restore, recently closed, task manager, lifecycle events (editor), CLI/socket--type=editoraliases, and extension sidebar kinds gain code-editor awareness; localized strings and example sidebar icons follow the curly-braces motif.Reviewed by Cursor Bugbot for commit 09e7889. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds a first‑class
editorsurface alongsidebrowser, defaulting tohttps://vscode.dev, with its own UI (omnibar hidden). Editor tabs are excluded from browser history, open‑tab suggestions, and global browser search. Addresses #648.New Features
cmux.newCodeEditor), splits, and CLI/socket (new_pane/new_surface --type=editor; aliases: editor/code/codeeditor/vscode/vscodeinline); included in default tab bar config.CmuxExtensionKit),CmuxWorkspaceCore.SurfaceKind(editor), lifecycle/automation emittype: editor;PanelType(externalValue:)accepts editor/vscode aliases; browser‑only omnibar/search/shortcuts constrained to.browser.Bug Fixes
editorsurface kind.Written for commit 4bde2d7. Summary will update on new commits.
Summary by CodeRabbit