Repository navigation
Add configurable Cmd+Shift/Option+Shift override for sidebar PR links - #686
lawrencecchen wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe PR implements modifier key-based customization for opening pull request links. It introduces a new Changes
Sequence DiagramsequenceDiagram
actor User
participant TabItemView
participant ContentView
participant BrowserLinkOpenSettings
participant Browser
User->>TabItemView: Clicks PR link (with modifier key)
TabItemView->>ContentView: updateSelection(modifierFlags)
ContentView->>ContentView: openWorkspacePullRequestsInConfiguredBrowser(modifierFlags)
ContentView->>BrowserLinkOpenSettings: shouldOpenSidebarPullRequestLinkInCmuxBrowser(modifierFlags)
BrowserLinkOpenSettings->>BrowserLinkOpenSettings: linkModifierOverrideOpensInCmuxBrowser(modifierFlags)
alt Override modifier configured
BrowserLinkOpenSettings-->>BrowserLinkOpenSettings: Returns Bool (opens in cmux or default)
else No override modifier
BrowserLinkOpenSettings->>BrowserLinkOpenSettings: Fall back to openSidebarPullRequestLinksInCmuxBrowser
BrowserLinkOpenSettings-->>BrowserLinkOpenSettings: Returns Bool (default behavior)
end
BrowserLinkOpenSettings-->>ContentView: shouldOpen → Bool
ContentView->>Browser: Open PR link in configured browser
Browser-->>User: Display PR
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cmuxTests/CmuxWebViewKeyEquivalentTests.swift (1)
7647-7656: Consider adding one invalid-raw-value fallback test.A small extra test for an unknown persisted
linkModifierBehaviorKeyvalue would harden regression coverage for defaults migration/fallback behavior.💡 Suggested test addition
+ func testLinkModifierBehaviorFallsBackToDefaultForInvalidStoredValue() { + defaults.set("not-a-valid-behavior", forKey: BrowserLinkOpenSettings.linkModifierBehaviorKey) + XCTAssertEqual( + BrowserLinkOpenSettings.linkModifierBehavior(defaults: defaults), + .commandShiftOpensCmuxOptionShiftOpensDefault + ) + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift` around lines 7647 - 7656, Add a test (e.g. testLinkModifierBehaviorFallsBackOnInvalidRawValue) that writes an invalid/unknown value into UserDefaults for BrowserLinkOpenSettings.linkModifierBehaviorKey, then call BrowserLinkOpenSettings.linkModifierBehavior(defaults: defaults) and assert it falls back to the same value returned when the key is absent (remove the key and call linkModifierBehavior again) to verify unknown raw values use the safe fallback; reference BrowserLinkOpenSettings.linkModifierBehavior(defaults:) and BrowserLinkOpenSettings.linkModifierBehaviorKey in the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift`:
- Around line 7647-7656: Add a test (e.g.
testLinkModifierBehaviorFallsBackOnInvalidRawValue) that writes an
invalid/unknown value into UserDefaults for
BrowserLinkOpenSettings.linkModifierBehaviorKey, then call
BrowserLinkOpenSettings.linkModifierBehavior(defaults: defaults) and assert it
falls back to the same value returned when the key is absent (remove the key and
call linkModifierBehavior again) to verify unknown raw values use the safe
fallback; reference BrowserLinkOpenSettings.linkModifierBehavior(defaults:) and
BrowserLinkOpenSettings.linkModifierBehaviorKey in the test.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
Sources/ContentView.swiftSources/Panels/BrowserPanel.swiftSources/cmuxApp.swiftcmuxTests/CmuxWebViewKeyEquivalentTests.swift
Greptile SummaryAdded configurable modifier override for sidebar PR links, allowing users to customize Cmd+Shift and Option+Shift behaviors for opening links in either cmux or default browser. The implementation correctly captures modifier flags before selection updates to prevent unintended multi-select side effects, and falls back to the existing toggle setting when no override modifier is pressed.
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: fb1abc4 |
Summary
Validation
Summary by CodeRabbit
New Features
Tests