Repository navigation
Open whole Cloud sidebar tool as a pane #12483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e9aafce
test: cover opening the whole Cloud tool as a pane
austinywang 2f8f5af
fix: drag the whole Cloud sidebar tool into panes
austinywang 97ebc79
fix: localize Cloud pane command
austinywang 76403f3
fix: gate Cloud pane command by availability
austinywang 8050eed
fix: quote right sidebar tool project path
austinywang 001faa1
Restore Cloud terminal provider compatibility methods
lawrencecchen 4e4107a
fix: isolate Cloud terminal close compatibility
austinywang c557530
fix: quote Cloud terminal compatibility path
austinywang 0131745
fix: place Cloud terminal compatibility file in Surfaces group
austinywang 0cdc6bf
fix: expose Cloud close state to extension
austinywang 86cc33a
fix: gate restored Cloud pane availability
austinywang a2b68a2
test: expect Cloud mode to be pane-capable
austinywang e19a65d
fix: expose Cloud pending creation type to extension
austinywang db22e2b
fix: gate Cloud tool workspace creation
austinywang ebf38a0
fix: implement Cloud close terminal protocol entrypoint
austinywang c0063f3
fix: retain whole-tool drag lease in provider
austinywang b5cc4de
fix: keep Cloud terminal text out of argv
austinywang 1fb2cf3
fix: expose Cloud close state across provider files
austinywang 5070aa4
fix: match Cloud workspace identity helper signature
austinywang 7e23742
fix: share Cloud store and stop hidden pane polling
austinywang efbbe6e
fix: hide unavailable Cloud tool panes
austinywang 01b7b64
fix: hide unavailable Cloud pane action
austinywang 9a5ba73
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang 186aaff
chore: keep merged Swift files within budget
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import AppKit | ||
| import Bonsplit | ||
| import UniformTypeIdentifiers | ||
|
|
||
| /// Drag payload for reordering the mode bar's tabs in place. Same shape as | ||
| /// `SidebarTabDragPayload`: an in-process custom UTI (declared in | ||
| /// `Resources/Info.plist` under `UTExportedTypeDeclarations`) carrying the | ||
| /// dragged mode's raw value. | ||
| enum RightSidebarModeDragPayload { | ||
| static let typeIdentifier = "com.cmux.right-sidebar-mode-reorder" | ||
| static let dropContentType = UTType(exportedAs: typeIdentifier) | ||
|
|
||
| @MainActor | ||
| static func provider(for mode: RightSidebarMode, registry: TabDragTransferRegistry? = nil) -> NSItemProvider { | ||
| let provider = NSItemProvider() | ||
| let data = Data(mode.rawValue.utf8) | ||
| provider.registerDataRepresentation( | ||
| forTypeIdentifier: typeIdentifier, | ||
| visibility: .ownProcess | ||
| ) { completion in | ||
| completion(data, nil) | ||
| return nil | ||
| } | ||
| if let registry = registry ?? AppDelegate.shared?.tabDragTransferRegistry { | ||
| RightSidebarToolDragPayload(mode: mode).register(with: registry)?.register(with: provider) | ||
| } | ||
| return provider | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import AppKit | ||
| import Bonsplit | ||
|
|
||
| /// Describes a whole sidebar tool using Bonsplit's process-local drag lease. | ||
| /// The mode lives in registered metadata, never in a terminal resource or title. | ||
| struct RightSidebarToolDragPayload { | ||
| let mode: RightSidebarMode | ||
|
|
||
| init(mode: RightSidebarMode) { | ||
| self.mode = mode | ||
| } | ||
|
|
||
| init?(transfer: TabDragTransfer) { | ||
| let prefix = "rightSidebarTool:" | ||
| guard let kind = transfer.tab.kind, kind.hasPrefix(prefix), | ||
| let mode = RightSidebarMode(rawValue: String(kind.dropFirst(prefix.count))), | ||
| mode.canOpenAsPane else { return nil } | ||
| self.mode = mode | ||
| } | ||
|
|
||
| @MainActor | ||
| func register(with registry: TabDragTransferRegistry) -> TabDragTransferRegistration? { | ||
| guard mode.canOpenAsPane, mode.isAvailable() else { return nil } | ||
| let id = UUID() | ||
| return registry.register(TabDragTransfer( | ||
| tab: Bonsplit.Tab(id: TabID(uuid: id), title: mode.label, | ||
| icon: mode.symbolName, kind: "rightSidebarTool:\(mode.rawValue)"), | ||
| sourcePaneId: PaneID(id: id) | ||
| )) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import Bonsplit | ||
| import Foundation | ||
|
|
||
| extension Workspace { | ||
| /// Opens or repositions one tool at the actual drop location. No Cloud | ||
| /// resource is projected, moved, or created when the tool itself is opened. | ||
| func handleRightSidebarToolDrop( | ||
| mode: RightSidebarMode, | ||
| destination: BonsplitController.ExternalTabDropRequest.Destination | ||
| ) -> Bool { | ||
| guard !isRetiredFromOwningTabManager, mode.canOpenAsPane, mode.isAvailable() else { return false } | ||
| let target: PaneID | ||
| switch destination { | ||
| case .insert(let pane, _), .split(let pane, _, _): target = pane | ||
| } | ||
| guard bonsplitController.allPaneIds.contains(target) else { return false } | ||
| let existing = panels.values.compactMap { $0 as? RightSidebarToolPanel }.first { $0.mode == mode } | ||
| guard let panel = existing ?? newRightSidebarToolSurface(inPane: target, mode: mode, focus: false), | ||
| let tab = surfaceIdFromPanelId(panel.id) else { return false } | ||
| let placed: Bool | ||
| switch destination { | ||
| case .insert(let pane, let index): | ||
| placed = bonsplitController.moveTab(tab, toPane: pane, atIndex: index) | ||
| case .split(let pane, let orientation, let insertFirst): | ||
| placed = bonsplitController.splitPane( | ||
| pane, orientation: orientation, movingTab: tab, insertFirst: insertFirst | ||
| ) != nil | ||
| } | ||
| guard placed else { | ||
| if existing == nil { _ = bonsplitController.closeTab(tab) } | ||
| return false | ||
| } | ||
| clearSplitZoom() | ||
| focusPanel(panel.id) | ||
| return true | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove the unapproved locale translations from this new key.
New localization keys should contain only audited
enandjatranslations unless additional locales are explicitly re-enabled. The Arabic value,فتح Cloud كجزء, also does not express “Open Cloud as Pane”.Based on learnings: New
Resources/*.xcstringsentries should target only English (en) and Japanese (ja).🤖 Prompt for AI Agents
Source: Learnings