Skip to content

Mirror VS Code workbench shortcuts in terminal#112

Merged
nedtwigg merged 3 commits into
mainfrom
vscode-shortcuts
May 28, 2026
Merged

Mirror VS Code workbench shortcuts in terminal#112
nedtwigg merged 3 commits into
mainfrom
vscode-shortcuts

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

Summary

  • mirror selected VS Code workbench chords from the terminal webview while still letting xterm process them
  • add a typed, allowlisted dormouse:runWorkbenchCommand bridge for Quick Open, Command Palette, and sidebar toggle
  • document the mirrored-chord behavior across layout, shortcut, transport, and VS Code specs

Verification

  • pnpm.cmd --filter dormouse-lib test src/lib/vscode-keybindings.test.ts src/lib/platform/vscode-adapter.test.ts
  • pnpm.cmd --filter dormouse-lib build
  • pnpm.cmd --filter dormouse build
  • pnpm dogfood:vscode

nedtwigg and others added 2 commits May 28, 2026 14:21
Code: derive the host-side allowlist Set from the new
VSCODE_WORKBENCH_COMMANDS const in vscode-keybindings.ts (and the
VSCodeWorkbenchCommand type from it too), so the command list is no
longer enumerated separately in message-router.ts.

Detection: drop isVSCodePlatform() and gate the keydown handler on the
presence of getPlatform().runWorkbenchCommand, matching the existing
openExternal?.() optional-method escape-hatch pattern.

Docs: enumerate the mirrored chords only in vscode.md (which names the
code source of truth); layout.md, shortcuts.md, and transport.md now
link there instead of re-listing the keys.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 28, 2026

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: e878eb8
Status: ✅  Deploy successful!
Preview URL: https://0a141d93.mouseterm.pages.dev
Branch Preview URL: https://vscode-shortcuts.mouseterm.pages.dev

View logs

Copy link
Copy Markdown
Collaborator

@dormouse-bot dormouse-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing as a draft — flagging anything that looks worth a quick fix. Mark ready for a full review.

One observation on the F1 branch — see inline.

Comment thread lib/src/lib/vscode-keybindings.ts Outdated
Co-authored-by: dormouse-bot <ned.twigg+dormouse-bot@diffplug.com>
@nedtwigg nedtwigg marked this pull request as ready for review May 28, 2026 22:13
Copy link
Copy Markdown
Collaborator

@dormouse-bot dormouse-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good — F1 modifier guard fix is correct and the doc updates are thorough.

One small follow-up: the latest commit pins the bug behavior (Shift+F1 no longer mirrors), but the test file doesn't yet have a case for it — easy to drop the new !event.shiftKey guard in a future refactor without anything failing. Suggested addition inline.


expect(vscodeWorkbenchCommandForKeydown(keydown({ key: 'r', code: 'KeyR', ctrlKey: true }), opts)).toBe(null);
expect(vscodeWorkbenchCommandForKeydown(keydown({ key: 'c', code: 'KeyC', ctrlKey: true }), opts)).toBe(null);
expect(vscodeWorkbenchCommandForKeydown(keydown({ key: 'p', code: 'KeyP', ctrlKey: true, altKey: true }), opts)).toBe(null);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin the fix from e878eb8 with a regression test so the !event.shiftKey guard on the F1 branch isn't silently dropped later.

Suggested change
expect(vscodeWorkbenchCommandForKeydown(keydown({ key: 'p', code: 'KeyP', ctrlKey: true, altKey: true }), opts)).toBe(null);
expect(vscodeWorkbenchCommandForKeydown(keydown({ key: 'p', code: 'KeyP', ctrlKey: true, altKey: true }), opts)).toBe(null);
expect(vscodeWorkbenchCommandForKeydown(keydown({ key: 'F1', code: 'F1', shiftKey: true }), opts)).toBe(null);

@nedtwigg nedtwigg merged commit f942be4 into main May 28, 2026
9 of 10 checks passed
@nedtwigg nedtwigg deleted the vscode-shortcuts branch May 28, 2026 22:50
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.

2 participants