fix: rebind Create Symbolic Link shortcut to Cmd+Opt+L to resolve Make Active collision - #841
Open
YuriNachos wants to merge 1 commit into
Open
fix: rebind Create Symbolic Link shortcut to Cmd+Opt+L to resolve Make Active collision#841YuriNachos wants to merge 1 commit into
YuriNachos wants to merge 1 commit into
Conversation
…e Active collision
Both SelectCommand (Make Active) and CreateSymbolicLinkCommand bound the same
⌘⌥S shortcut. SwiftUI silently keeps only the first-declared .keyboardShortcut,
so the Create Symbolic Link menu item rendered the ⌘⌥S glyph but could never be
triggered from the keyboard — no compiler warning, no runtime error.
Route the six always-on CommandMenu shortcuts through an XcodeCommandShortcuts
seam so the set is testable, rebind Create Symbolic Link to ⌘⌥L ("L" for Link),
and add XcodeCommandShortcutsTests asserting the shortcuts are pairwise distinct
so this silent regression cannot return.
Co-Authored-By: Claude <noreply@anthropic.com>
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Two items in the Xcode
CommandMenubind the same keyboard shortcut (⌘⌥S), so one of them can never be triggered from the keyboard:SelectCommand("Make Active") —XcodeCommands.swift.keyboardShortcut("s", modifiers: [.command, .option])CreateSymbolicLinkCommand("Create Symbolic Link") — same.keyboardShortcut("s", modifiers: [.command, .option])SwiftUI resolves duplicate
.keyboardShortcutmodifiers silently: both menu items render the ⌘⌥S glyph, but pressing ⌘⌥S only ever fires Make Active (the first-declared binding). Create Symbolic Link is unreachable from the keyboard. There is no compiler warning and no runtime error — the regression is invisible without manual testing.Solution
Rebind
CreateSymbolicLinkCommandto ⌘⌥L ("L" for Link).Lis unused among the menu's current letters (S/↓/R/C/U/I), it is the natural mnemonic for "Link", andMake Activestays onS.To make this silent class of regression testable, the six always-on command shortcuts are centralized in a small
enum XcodeCommandShortcutsnamespace ofstatic let KeyboardShortcutconstants, and the six Command views read from those constants. A newXcodeCommandShortcutsTestsasserts the six are pairwise distinct — turning a future duplicate binding into a failing build instead of a silently-broken menu.Make Activestays on ⌘⌥S (unchanged).Create Symbolic Linkmoves ⌘⌥S → ⌘⌥L (the fix).Open ⌘↓,Reveal ⌘⌥R,Copy Path ⌘⌥C,Uninstall ⌘⌥U) are byte-identical, just routed through the seam.Install("⌘⌥I") /Cancel Install("⌘.") shortcuts are mutually exclusive and intentionally not added to the seam.Impact
git show main:…/XcodeCommands.swift).Localizable.xcstringsis untouched — the menu glyph is rendered from thekeyboardShortcutmodifier, andCreateSymbolicLinkButton.help("CreateSymLink")is a localization key, not a hardcoded glyph, so the 18-languagexcstrings.ymlCI is not affected.XcodeCommands.swiftbehavior + a new pure-logic test; no model/AppState change.Testing
XcodeCommandShortcutsseam mirroring the old (buggy) values (makeActive= ⌘⌥S andcreateSymbolicLink= ⌘⌥S),XcodeCommandShortcutsTestsfails (two shortcuts collide). After rebindingcreateSymbolicLinkto ⌘⌥L, it passes.createSymbolicLinkback to"s"re-fails the test (proves the guard is not theater), then restored to"l".xcodebuild test -scheme Xcodes -destination 'platform=macOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -only-testing:XcodesTests/XcodeCommandShortcutsTests→ TEST SUCCEEDED (1 test, 0 failures).Checklist
XcodeCommands.swift+ new test + test-target registration inproject.pbxproj(registration only).Localizable.xcstringsbyte-identical tomain.Authored by
@YuriNachos. Implementation written by acccc(Claude Code, GLM-5.2) worker under orchestrator acceptance — gate green and an independent adversarial review returned APPROVE with no blocking findings.