Add ⌘P project switcher (VS Code-style) with per-project worktree memory#370
Add ⌘P project switcher (VS Code-style) with per-project worktree memory#370COCPORN wants to merge 1 commit into
Conversation
Adds a project switcher on ⌘P and moves the existing Command Palette to ⌘⇧P, aligning with VS Code (⌘⇧P = Command Palette; ⌘P = fast navigation). Both shortcuts remain user-rebindable via shortcut overrides. - ⌘P opens a fuzzy switcher of repositories ordered most-recently-used. The current project is rendered (so you see where you are) but flagged `isCurrentProject` so the default selection lands on the *previous* project — ⌘P then Enter is a Cmd+Tab-style toggle. Typing snaps to the top fuzzy match. - Switching to a project resolves to the worktree you last had open there (`lastWorktreeByProject`), falling back to main/first. The MRU is recorded on BOTH navigation paths — `setSingleWorktreeSelection` (hotkeys/palette) and `reduceSelectionChangedEffect` (sidebar clicks) — so it works however you navigate. - New `PaletteMode` (.commands / .projectSwitcher), `selectProject` item/ delegate, and a `dismissedWithoutSelection` delegate so cancelling the palette refocuses the current terminal. - Command Palette hint text updated ⌘P → ⌘⇧P. Covered by CommandPaletteFeatureTests and RepositoriesFeatureProjectMRUTests (switcher ordering/flagging, defaultIndex seeding, sidebar-path MRU recording). Implemented with AI assistance (Claude Code); reviewed and verified in a real build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
I've made a quick video showcasing the changes. Let me know if you're interested, I'll turn it into two PRs, if not I'm happy to just run off this private fork going forward. The terminal-focus I actually consider a bug, I'd try to patch that even if you don't care for the project switcher. Thanks for considering it. Supacode.PR.Project.Swap.and.Terminal.Focus-web.mp4 |
|
Genuinely loving this ❤️ thanks |
|
So I've played a bit more with this, and I feel like the use case for this, exactly as implemented, relies too much on the assumption from the video that most "projects" only have one worktree. It becomes almost useless for agentic-driven multi-worktree scenarios, which tend to be the main use case for Supacode. I think the idea still has its merits, though, and I'd be more than happy to merge the two concerns, basically translating this into a palette for worktree selection history plus fuzzy search for everything not in history. Wdyt? @COCPORN |
What
Adds a project switcher on ⌘P and moves the existing Command Palette to ⌘⇧P.
Why this binding
Aligns with VS Code muscle memory:
Both are rebindable or disablable in Settings → Keyboard Shortcuts → General, so this only changes the defaults — anyone who wants ⌘P back on the palette can set it.
Behavior
Tests
CommandPaletteFeatureTests+RepositoriesFeatureProjectMRUTests— switcher ordering/flagging, defaultIndex seeding, and sidebar-path MRU recording. This PR's CI runs them.Disclosure
Implemented with AI assistance (Claude Code); reviewed and verified in a real build.