Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
61cb5f7
Add code editor surface type
austinywang May 26, 2026
f0187eb
Merge remote-tracking branch 'origin/main' into issue-648-add-vscode-…
austinywang May 26, 2026
f70af7f
Fix code editor closed history title
austinywang May 26, 2026
5ed8f3c
Address code editor review feedback
austinywang May 26, 2026
254ed0d
Fix code editor directory fallback compile
austinywang May 26, 2026
2447b26
Return code editor panel id during async open
austinywang May 26, 2026
8234af7
Merge origin/main into issue-648-add-vscode-cursor-like-code-editor-as-a
austinywang Jun 6, 2026
63f4b46
Fix code editor cwd resolution
austinywang Jun 6, 2026
ba42617
Fix editor surface routing and metadata
austinywang Jun 6, 2026
c3bce0b
Fix sidebar editor surface kind
austinywang Jun 6, 2026
3821ea0
Handle code editor serve-web failures
austinywang Jun 6, 2026
0f59d90
Fix provisional editor discard test setup
austinywang Jun 6, 2026
e2304d0
Route code editor splits through folder-aware open path
austinywang Jun 6, 2026
74e3192
Guard async code editor folder navigation
austinywang Jun 6, 2026
6260a00
Align code editor labels and icons
austinywang Jun 6, 2026
09e7889
Honor code editor surface defaults
austinywang Jun 6, 2026
d28f34f
Merge remote-tracking branch 'origin/main' into issue-648-add-vscode-…
austinywang Jun 14, 2026
2322b83
Merge remote-tracking branch 'origin/main' into issue-648-add-vscode-…
austinywang Jun 14, 2026
0d93de6
chore: refresh Swift file length budget
austinywang Jun 14, 2026
cdba88c
fix: handle code editor canvas icon
austinywang Jun 14, 2026
391cd0a
fix: stabilize code editor async handling
austinywang Jun 14, 2026
8a9bfed
Merge remote-tracking branch 'origin/main' into issue-648-add-vscode-…
austinywang Jun 14, 2026
1661c10
merge: resolve conflicts with main
austinywang Jun 18, 2026
4bde2d7
fix: use raw surface kind for editor tab action
austinywang Jun 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,785 changes: 1,785 additions & 0 deletions Resources/Localizable.xcstrings

Large diffs are not rendered by default.

82 changes: 78 additions & 4 deletions Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7296,9 +7296,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
return false
}

let targetWorkspaceId = targetTabManager.selectedWorkspace?.id
?? targetTabManager.tabs.first?.id
?? targetTabManager.addWorkspace(select: true).id
let targetWorkspace = targetTabManager.selectedWorkspace
?? targetTabManager.tabs.first
?? targetTabManager.addWorkspace(select: true)
let targetWorkspaceId = targetWorkspace.id
let normalizedDirectoryURL = directoryURL.standardizedFileURL

VSCodeServeWebController.shared.ensureServeWebURL(vscodeApplicationURL: vscodeApplicationURL) { serveWebURL in
Expand All @@ -7311,7 +7312,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
return
}

guard targetTabManager.openBrowser(
guard targetTabManager.openCodeEditor(
inWorkspace: targetWorkspaceId,
url: openFolderURL,
preferSplitRight: true
Expand All @@ -7324,6 +7325,73 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
return true
}

@discardableResult
func openCodeEditor(
tabManager preferredTabManager: TabManager? = nil,
url requestedURL: URL? = nil,
preferSplitRight: Bool = false,
insertAtEnd: Bool = false
) -> UUID? {
let targetTabManager = preferredTabManager
?? preferredMainWindowContextForWorkspaceCreation(debugSource: "codeEditor.open.target")?.tabManager
guard let targetTabManager else {
NSSound.beep()
return nil
}

let targetWorkspace = targetTabManager.selectedWorkspace
?? targetTabManager.tabs.first
?? targetTabManager.addWorkspace(select: true)
let targetWorkspaceId = targetWorkspace.id

if let requestedURL {
return targetTabManager.openCodeEditor(
inWorkspace: targetWorkspaceId,
url: requestedURL,
preferSplitRight: preferSplitRight,
insertAtEnd: insertAtEnd
)
}

func openDefaultCodeEditor() -> UUID? {
targetTabManager.openCodeEditor(
inWorkspace: targetWorkspaceId,
url: BrowserPanel.SurfaceRole.codeEditor.defaultInitialURL,
preferSplitRight: preferSplitRight,
insertAtEnd: insertAtEnd
)
}

guard let directoryPath = Self.initialCodeEditorDirectoryPath(for: targetWorkspace),
let vscodeApplicationURL = TerminalDirectoryOpenTarget.vscodeInline.applicationURL() else {
return openDefaultCodeEditor()
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
}

guard let panelId = openDefaultCodeEditor() else {
NSSound.beep()
return nil
}

VSCodeServeWebController.shared.ensureServeWebURL(vscodeApplicationURL: vscodeApplicationURL) { serveWebURL in
guard let serveWebURL,
let openFolderURL = VSCodeServeWebURLBuilder.openFolderURL(
baseWebUIURL: serveWebURL,
directoryPath: directoryPath
) else {
return
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

targetTabManager.browserPanel(tabId: targetWorkspaceId, panelId: panelId)?
.navigate(to: openFolderURL)
Comment thread
austinywang marked this conversation as resolved.
Resolved
}

return panelId
}

static func initialCodeEditorDirectoryPath(for workspace: Workspace) -> String? {
workspace.resolvedWorkingDirectory()
}

func showOpenFolderInInlineVSCodePanel(tabManager preferredTabManager: TabManager? = nil) {
guard TerminalDirectoryOpenTarget.vscodeInline.isAvailable() else {
NSSound.beep()
Expand Down Expand Up @@ -14959,6 +15027,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
}
onExecuted?()
return true
case .newCodeEditor:
guard openCodeEditor(tabManager: context.tabManager, insertAtEnd: true) != nil else {
return false
}
onExecuted?()
return true
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
case .splitRight:
if shouldSuppressSplitShortcutForTransientTerminalFocusState(
direction: .right,
Expand Down
2 changes: 2 additions & 0 deletions Sources/ClosedItemHistory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ final class ClosedItemHistoryStore: ObservableObject {
return String(localized: "menu.history.recentlyClosed.panel.terminal", defaultValue: "Terminal")
case .browser:
return String(localized: "menu.history.recentlyClosed.panel.browser", defaultValue: "Browser")
case .codeEditor:
return String(localized: "menu.history.recentlyClosed.panel.codeEditor", defaultValue: "Code Editor")
case .markdown:
return String(localized: "menu.history.recentlyClosed.panel.markdown", defaultValue: "Markdown")
case .filePreview:
Expand Down
37 changes: 37 additions & 0 deletions Sources/CmuxConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1172,12 +1172,14 @@ struct CmuxSurfaceTabBarButton: Codable, Sendable, Hashable, Identifiable {

static let newTerminal = actionReference(CmuxSurfaceTabBarBuiltInAction.newTerminal.configID)
static let newBrowser = actionReference(CmuxSurfaceTabBarBuiltInAction.newBrowser.configID)
static let newCodeEditor = actionReference(CmuxSurfaceTabBarBuiltInAction.newCodeEditor.configID)
static let splitRight = actionReference(CmuxSurfaceTabBarBuiltInAction.splitRight.configID)
static let splitDown = actionReference(CmuxSurfaceTabBarBuiltInAction.splitDown.configID)

static let defaults: [CmuxSurfaceTabBarButton] = [
.newTerminal,
.newBrowser,
.newCodeEditor,
.splitRight,
.splitDown
]
Expand Down Expand Up @@ -1562,6 +1564,9 @@ struct CmuxResolvedConfigAction: Identifiable, Sendable, Hashable {
case .newBrowser:
title = String(localized: "command.newBrowserTab.title", defaultValue: "New Browser Tab")
keywords = ["new", "browser", "tab", "surface"]
case .newCodeEditor:
title = String(localized: "command.newCodeEditorTab.title", defaultValue: "New Code Editor Tab")
keywords = ["new", "code", "editor", "tab", "surface", "vscode"]
case .splitRight:
title = String(localized: "command.terminalSplitRight.title", defaultValue: "Split Right")
keywords = ["terminal", "split", "right"]
Expand Down Expand Up @@ -1816,7 +1821,38 @@ struct CmuxSurfaceDefinition: Codable, Sendable {
enum CmuxSurfaceType: String, Codable, Sendable {
case terminal
case browser
case codeEditor = "editor"
case project

init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let rawValue = try container.decode(String.self)
let normalized = rawValue
.trimmingCharacters(in: .whitespacesAndNewlines)
.replacingOccurrences(of: "-", with: "")
.replacingOccurrences(of: "_", with: "")
.lowercased()
switch normalized {
case Self.terminal.rawValue:
self = .terminal
case Self.browser.rawValue:
self = .browser
case "editor", "code", "codeeditor", "vscode", "vscodeinline":
self = .codeEditor
case Self.project.rawValue:
self = .project
default:
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "Unknown surface type: \(rawValue)"
)
}
}

func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(rawValue)
}
}

struct CmuxResolvedCommand: Sendable {
Expand Down Expand Up @@ -2253,6 +2289,7 @@ final class CmuxConfigStore: ObservableObject {
}) ?? [
.builtIn(.newTerminal),
.builtIn(.newBrowser),
.builtIn(.newCodeEditor),
.builtIn(.splitRight),
.builtIn(.splitDown)
]
Expand Down
2 changes: 2 additions & 0 deletions Sources/CmuxLifecycleEventPublishing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ extension Workspace {
return "terminal"
case .browser:
return "browser"
case .codeEditor:
return "editor"
case .markdown:
return "markdown"
case .filePreview:
Expand Down
7 changes: 6 additions & 1 deletion Sources/CmuxSurfaceTabBarBuiltInAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ enum CmuxSurfaceTabBarBuiltInAction: String, Codable, Sendable, CaseIterable, Ha
case cloudVM = "cmux.cloudvm"
case newTerminal = "cmux.newTerminal"
case newBrowser = "cmux.newBrowser"
case newCodeEditor = "cmux.newCodeEditor"
case splitRight = "cmux.splitRight"
case splitDown = "cmux.splitDown"

Expand All @@ -21,6 +22,8 @@ enum CmuxSurfaceTabBarBuiltInAction: String, Codable, Sendable, CaseIterable, Ha
self = .newTerminal
case "cmux.newBrowser", "newBrowser":
self = .newBrowser
case "cmux.newCodeEditor", "cmux.newEditor", "newCodeEditor", "newEditor", "codeEditor", "editor":
self = .newCodeEditor
case "cmux.splitRight", "splitRight":
self = .splitRight
case "cmux.splitDown", "splitDown":
Expand All @@ -44,6 +47,8 @@ enum CmuxSurfaceTabBarBuiltInAction: String, Codable, Sendable, CaseIterable, Ha
return "terminal"
case .newBrowser:
return "globe"
case .newCodeEditor:
return "curlybraces.square"
case .splitRight:
return "square.split.2x1"
case .splitDown:
Expand All @@ -53,7 +58,7 @@ enum CmuxSurfaceTabBarBuiltInAction: String, Codable, Sendable, CaseIterable, Ha

var bonsplitAction: BonsplitConfiguration.SplitActionButton.Action? {
switch self {
case .newWorkspace, .cloudVM:
case .newWorkspace, .cloudVM, .newCodeEditor:
return nil
case .newTerminal:
return .newTerminal
Expand Down
45 changes: 45 additions & 0 deletions Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5941,6 +5941,8 @@ struct ContentView: View {
return String(localized: "commandPalette.kind.terminal", defaultValue: "Terminal")
case .browser:
return String(localized: "commandPalette.kind.browser", defaultValue: "Browser")
case .codeEditor:
return String(localized: "commandPalette.kind.codeEditor", defaultValue: "Code Editor")
case .markdown:
return String(localized: "commandPalette.kind.markdown", defaultValue: "Markdown")
case .filePreview:
Expand All @@ -5960,6 +5962,8 @@ struct ContentView: View {
return ["terminal", "shell", "console"]
case .browser:
return ["browser", "web", "page"]
case .codeEditor:
return ["code", "editor", "vscode", "vs", "cursor"]
case .markdown:
return ["markdown", "note", "preview"]
case .filePreview:
Expand Down Expand Up @@ -6469,6 +6473,8 @@ struct ContentView: View {
return CmuxSurfaceTabBarBuiltInAction.newTerminal.configID
case "palette.newBrowserTab":
return CmuxSurfaceTabBarBuiltInAction.newBrowser.configID
case "palette.newCodeEditorTab":
return CmuxSurfaceTabBarBuiltInAction.newCodeEditor.configID
case "palette.terminalSplitRight":
return CmuxSurfaceTabBarBuiltInAction.splitRight.configID
case "palette.terminalSplitDown":
Expand Down Expand Up @@ -6802,6 +6808,15 @@ struct ContentView: View {
when: { !$0.bool(CommandPaletteContextKeys.browserDisabled) }
)
)
contributions.append(
CommandPaletteCommandContribution(
commandId: "palette.newCodeEditorTab",
title: constant(String(localized: "command.newCodeEditorTab.title", defaultValue: "New Tab (Code Editor)")),
subtitle: constant(String(localized: "command.newCodeEditorTab.subtitle", defaultValue: "Tab")),
keywords: ["new", "code", "editor", "tab", "vscode", "vs", "cursor"],
when: { !$0.bool(CommandPaletteContextKeys.browserDisabled) }
)
)
contributions.append(
CommandPaletteCommandContribution(
commandId: "palette.closeTab",
Expand Down Expand Up @@ -7503,6 +7518,24 @@ struct ContentView: View {
}
)
)
contributions.append(
CommandPaletteCommandContribution(
commandId: "palette.codeEditorSplitRight",
title: constant(String(localized: "command.codeEditorSplitRight.title", defaultValue: "Split Code Editor Right")),
subtitle: constant(String(localized: "command.codeEditorSplitRight.subtitle", defaultValue: "Code Editor Layout")),
keywords: ["code", "editor", "split", "right", "vscode", "cursor"],
when: { !$0.bool(CommandPaletteContextKeys.browserDisabled) }
)
)
contributions.append(
CommandPaletteCommandContribution(
commandId: "palette.codeEditorSplitDown",
title: constant(String(localized: "command.codeEditorSplitDown.title", defaultValue: "Split Code Editor Down")),
subtitle: constant(String(localized: "command.codeEditorSplitDown.subtitle", defaultValue: "Code Editor Layout")),
keywords: ["code", "editor", "split", "down", "vscode", "cursor"],
when: { !$0.bool(CommandPaletteContextKeys.browserDisabled) }
)
)
contributions.append(
CommandPaletteCommandContribution(
commandId: "palette.browserDuplicateRight",
Expand Down Expand Up @@ -7968,6 +8001,12 @@ struct ContentView: View {
_ = AppDelegate.shared?.openBrowserAndFocusAddressBar()
}
}
registry.register(commandId: "palette.newCodeEditorTab") {
if executeConfiguredAction(id: CmuxSurfaceTabBarBuiltInAction.newCodeEditor.configID) {
return
}
_ = AppDelegate.shared?.openCodeEditor(tabManager: tabManager)
}
registry.register(commandId: "palette.closeTab") {
tabManager.closeCurrentPanelWithConfirmation()
}
Expand Down Expand Up @@ -8331,6 +8370,12 @@ struct ContentView: View {
registry.register(commandId: "palette.browserSplitDown") {
_ = tabManager.createBrowserSplit(direction: .down)
}
registry.register(commandId: "palette.codeEditorSplitRight") {
_ = tabManager.createCodeEditorSplit(direction: .right)
}
registry.register(commandId: "palette.codeEditorSplitDown") {
_ = tabManager.createCodeEditorSplit(direction: .down)
Comment thread
austinywang marked this conversation as resolved.
Resolved
}
registry.register(commandId: "palette.browserDuplicateRight") {
let url = tabManager.focusedBrowserPanel?.preferredURLStringForOmnibar().flatMap(URL.init(string:))
_ = tabManager.createBrowserSplit(direction: .right, url: url)
Expand Down
2 changes: 2 additions & 0 deletions Sources/KeyboardShortcutContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ extension AppDelegate {
for manager in shortcutCandidateTabManagers() {
for workspace in manager.tabs {
if let panel = workspace.browserPanel(for: panelId) {
guard panel.panelType == .browser else { continue }
return panel
}
}
Expand All @@ -228,6 +229,7 @@ extension AppDelegate {
for workspace in manager.tabs {
for panel in workspace.panels.values {
guard let browserPanel = panel as? BrowserPanel,
browserPanel.panelType == .browser,
browserPanel.webView === webView else {
continue
}
Expand Down
7 changes: 6 additions & 1 deletion Sources/Panels/BrowserOmnibarPerformanceSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ extension TabManager {
private func browserOpenTabSuggestionSeedSnapshots() -> [BrowserOpenTabSuggestionSnapshot] {
tabs.flatMap { workspace in
workspace.panels.compactMap { _, panel in
guard let browserPanel = panel as? BrowserPanel else { return nil }
guard let browserPanel = panel as? BrowserPanel,
browserPanel.surfaceRole.contributesToBrowserOpenTabSuggestions else { return nil }
return BrowserOpenTabSuggestionSnapshot(
workspaceId: workspace.id,
panelId: browserPanel.id,
Expand All @@ -271,6 +272,10 @@ extension TabManager {

extension Workspace {
func publishBrowserOpenTabSuggestion(for browserPanel: BrowserPanel) {
guard browserPanel.surfaceRole.contributesToBrowserOpenTabSuggestions else {
owningTabManager?.removeBrowserOpenTabSuggestion(panelId: browserPanel.id)
return
}
guard let snapshot = BrowserOpenTabSuggestionSnapshot(
workspaceId: id,
panelId: browserPanel.id,
Expand Down
Loading
Loading