mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-05-16 05:32:52 -04:00
## Summary
- Adds a **Settings → Keybindings → Keymap** dropdown with `VS Code`
(default) and `JetBrains` options.
- Previously CE unconditionally bound `Ctrl+D` to duplicate-selection —
a JetBrains habit that clobbered VS Code's
`editor.action.addSelectionToNextFindMatch` (multi-cursor). VS Code
users now keep their muscle memory; JetBrains users opt in.
- Under the JetBrains preset, also wires up `Ctrl+Y` → delete line and
`Ctrl+Shift+/` → block comment.
- Drive-by tidy of the existing **Ctrl+S behaviour** dropdown in the
same tab so it's full-width and consistent with every other settings
dropdown (it had its `<select>` nested inside the `<label>` and used a
`mb-3` typo that rendered as an unknown `<mb-3>` element).
## Audit notes
I went through every `addAction` / `addCommand` in
`static/panes/{editor,compiler,ir-view,device-view}.ts` and only
`Ctrl+D` was a clear VS Code/JetBrains conflict. The other custom
bindings (`Ctrl+Enter`, `Ctrl+Shift+Enter`, `Ctrl+F8/F9/F10`,
`Ctrl+Shift+F1`) are CE-feature-specific and don't conflict with either
editor's defaults, so they're untouched.
Considered but skipped:
- `Alt+Up/Down` (move line) — already the Monaco/VS Code default;
nothing to add.
- `Ctrl+W` / `Ctrl+Shift+W` (extend/shrink selection in JB) —
browser-reserved, can't be intercepted.
- `Ctrl+B` (go-to-declaration in JB) — Firefox steals it for the
bookmarks sidebar, and CE doesn't run language servers for compiled
languages so it'd be a near no-op anyway.
## UX
The Keymap label reads "Keymap *(refresh required)*" with the
parenthetical in `<em>` so it inherits the theme's foreground colour (no
black-on-black on dark mode when selected). The binding decision is read
at editor construction so a page reload is needed to pick up changes —
consistent with how `autoIndent` / `enableCodeLens` already behave.
## Test plan
- [x] Open Settings → Keybindings, see the new Keymap dropdown defaulted
to "VS Code", full-width and visually consistent with the Ctrl+S
dropdown below it.
- [x] Switch theme to dark and confirm the "(refresh required)" hint is
readable (and doesn't disappear when selected).
- [x] In default (VS Code) mode: `Ctrl+D` adds the next find match
(multi-cursor); `Ctrl+Y` redoes; `Ctrl+Shift+/` does nothing custom.
- [x] Switch to JetBrains, refresh: `Ctrl+D` duplicates the selection;
`Ctrl+Y` deletes the current line; `Ctrl+Shift+/` toggles a block
comment.
- [x] Existing users with stored settings (no \`keymap\` key) get the VS
Code default and lose the previous unconditional `Ctrl+D` binding
(intended — switch to JetBrains to restore it).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>