Skip to content

Allow host apps to extend tab context menus - #240

Open
lawrencecchen wants to merge 1 commit into
mainfrom
feat-focus-cloud-sidebar
Open

lawrencecchen wants to merge 1 commit into
mainfrom
feat-focus-cloud-sidebar

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 13, 2026 •

Copy link
Copy Markdown

Host apps can add native items to the menu for a clicked tab. The provider runs when the menu opens, so it uses the current tab state.

This supports the cmux Focus in Cloud Sidebar action. The API keeps Cloud behavior and translated text in the host app.

Validation: added a test for deferred provider calls and native item state. The focused test passed on a leased Mac (1 test).

@coderabbitai

coderabbitai Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ac2647c8-ec82-4c51-9cc6-36e757d9b240

📥 Commits

Reviewing files that changed from the base of the PR and between 4679197 and c99474c.

📒 Files selected for processing (5)
  • Sources/Bonsplit/Internal/Views/TabBarView.swift
  • Sources/Bonsplit/Internal/Views/TabContextMenuPresenter.swift
  • Sources/Bonsplit/Internal/Views/TabItemView.swift
  • Sources/Bonsplit/Public/BonsplitController.swift
  • Tests/BonsplitTests/TabContextMenuExtensionTests.swift

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Tab context-menu extension

Layer / File(s) Summary
Provider declaration and wiring
Sources/Bonsplit/Public/BonsplitController.swift, Sources/Bonsplit/Internal/Views/TabBarView.swift, Sources/Bonsplit/Internal/Views/TabItemView.swift, Sources/Bonsplit/Internal/Views/TabContextMenuPresenter.swift
BonsplitController exposes a main-actor provider for additional tab menu items. The provider flows through TabItemView into TabContextMenuSnapshot.
Menu construction and validation
Sources/Bonsplit/Internal/Views/TabItemView.swift, Tests/BonsplitTests/TabContextMenuExtensionTests.swift
TabContextMenuBuilder evaluates the provider when it builds a menu, appends returned items after browser actions, and adds a separator when needed. Tests verify invocation timing and menu contents.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: austinywang

Sequence Diagram(s)

sequenceDiagram
  participant BonsplitController
  participant TabItemView
  participant TabContextMenuBuilder
  participant NSMenu
  BonsplitController->>TabItemView: provide tab-specific menu items
  TabItemView->>TabContextMenuBuilder: pass additionalMenuItemsProvider
  TabContextMenuBuilder->>BonsplitController: request items when menu opens
  BonsplitController-->>TabContextMenuBuilder: return NSMenuItem list
  TabContextMenuBuilder->>NSMenu: append items after browser actions
Loading

Merge Risk: ⚪ Minimal · up to c9947

The tab context-menu extension preserves deferred provider evaluation and correctly supports fresh host-supplied native items. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: host apps can add items to tab context menus.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-focus-cloud-sidebar

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant