Skip to content

Add ⌘P project switcher (VS Code-style) with per-project worktree memory#370

Open
COCPORN wants to merge 1 commit into
supabitapp:mainfrom
COCPORN:pr/project-switcher
Open

Add ⌘P project switcher (VS Code-style) with per-project worktree memory#370
COCPORN wants to merge 1 commit into
supabitapp:mainfrom
COCPORN:pr/project-switcher

Conversation

@COCPORN
Copy link
Copy Markdown
Contributor

@COCPORN COCPORN commented May 30, 2026

What

Adds a project switcher on ⌘P and moves the existing Command Palette to ⌘⇧P.

Why this binding

Aligns with VS Code muscle memory:

  • ⌘⇧P → Command Palette — exact VS Code match.
  • ⌘P → fast navigation — VS Code's ⌘P (Quick Open) jumps to files; here it jumps to projects.

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

  • ⌘P opens a fuzzy switcher of repositories, MRU-ordered. The current project is shown but 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 returns you to the worktree you last had open in that project, recorded on both navigation paths (sidebar clicks and hotkeys/palette), falling back to main/first.
  • Cancelling the palette refocuses the current terminal.

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.

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>
@COCPORN
Copy link
Copy Markdown
Contributor Author

COCPORN commented May 30, 2026

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

@sbertix
Copy link
Copy Markdown
Collaborator

sbertix commented May 30, 2026

Genuinely loving this ❤️ thanks
(I'll try to review it asap)

@sbertix
Copy link
Copy Markdown
Collaborator

sbertix commented Jun 2, 2026

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

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.

3 participants