calva.showReplWindow doesn't work with alternate keybindings
Summary
I tried to add a shorter keybinding to calva.showReplWindow, but it fails to work, even when the Keyboard Shortcuts Troubleshooting pane says it's being invoked.
The default binding (Ctrl+Option+O, R) still works just fine (the cursor jumps to the repl window). I tried adding Ctrl+R, Ctrl+Shift+Option+R, and the chord Ctrl+R->Ctrl+R and none worked.
Just to make sure something else wasn't intercepting them, I added those as bindings to bookmark toggling, and they worked just fine, so it can't be those particular keys.
This happens in both VS Code 1.101.0 and Cursor 1.2.0.
Debugging output
Here's the Keyboard Shortcuts Troubleshooting pane output.
Standard chord - Ctrl+Option+O, R
Working:
2025-07-03 15:05:39.453 [info] [Window] [KeybindingService]: / Received keydown event - modifiers: [alt], code: AltLeft, keyCode: 18, key: Alt
2025-07-03 15:05:39.454 [info] [Window] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: AltLeft, keyCode: 6 ('Alt')
2025-07-03 15:05:39.454 [info] [Window] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2025-07-03 15:05:39.459 [info] [Window] [KeybindingService]: / Received keydown event - modifiers: [ctrl,alt], code: ControlRight, keyCode: 17, key: Control
2025-07-03 15:05:39.460 [info] [Window] [KeybindingService]: | Converted keydown event - modifiers: [ctrl,alt], code: ControlRight, keyCode: 5 ('Ctrl')
2025-07-03 15:05:39.460 [info] [Window] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2025-07-03 15:05:40.038 [info] [Window] [KeybindingService]: / Soft dispatching keyboard event
2025-07-03 15:05:40.039 [info] [Window] [KeybindingService]: | Resolving ctrl+alt+[KeyO]
2025-07-03 15:05:40.039 [info] [Window] [KeybindingService]: \ From 9 keybinding entries, awaiting 1 more chord(s), when: calva:keybindingsEnabled, source: user extension betterthantomorrow.calva.
2025-07-03 15:05:40.039 [info] [Window] [KeybindingService]: / Soft dispatching keyboard event
2025-07-03 15:05:40.039 [info] [Window] [KeybindingService]: | Resolving ctrl+alt+[KeyO]
2025-07-03 15:05:40.039 [info] [Window] [KeybindingService]: \ From 9 keybinding entries, awaiting 1 more chord(s), when: calva:keybindingsEnabled, source: user extension betterthantomorrow.calva.
2025-07-03 15:05:40.040 [info] [Window] [KeybindingService]: / Received keydown event - modifiers: [ctrl,alt], code: KeyO, keyCode: 79, key: ø
2025-07-03 15:05:40.040 [info] [Window] [KeybindingService]: | Converted keydown event - modifiers: [ctrl,alt], code: KeyO, keyCode: 45 ('O')
2025-07-03 15:05:40.040 [info] [Window] [KeybindingService]: | Resolving ctrl+alt+[KeyO]
2025-07-03 15:05:40.040 [info] [Window] [KeybindingService]: \ From 9 keybinding entries, awaiting 1 more chord(s), when: calva:keybindingsEnabled, source: user extension betterthantomorrow.calva.
2025-07-03 15:05:40.040 [info] [Window] [KeybindingService]: + Entering multi-chord mode...
2025-07-03 15:05:40.247 [info] [Window] [KeybindingService]: + Ignoring single modifier alt due to it being pressed together with other keys.
2025-07-03 15:05:40.744 [info] [Window] [KeybindingService]: / Soft dispatching keyboard event
2025-07-03 15:05:40.744 [info] [Window] [KeybindingService]: | Resolving ctrl+alt+[KeyO],[KeyR]
2025-07-03 15:05:40.744 [info] [Window] [KeybindingService]: \ From 2 keybinding entries, matched calva.showReplWindow, when: calva:connected && calva:keybindingsEnabled && !calva:outputWindowActive, source: user extension betterthantomorrow.calva.
2025-07-03 15:05:40.744 [info] [Window] [KeybindingService]: / Soft dispatching keyboard event
2025-07-03 15:05:40.744 [info] [Window] [KeybindingService]: | Resolving ctrl+alt+[KeyO],[KeyR]
2025-07-03 15:05:40.744 [info] [Window] [KeybindingService]: \ From 2 keybinding entries, matched calva.showReplWindow, when: calva:connected && calva:keybindingsEnabled && !calva:outputWindowActive, source: user extension betterthantomorrow.calva.
2025-07-03 15:05:40.745 [info] [Window] [KeybindingService]: / Received keydown event - modifiers: [], code: KeyR, keyCode: 82, key: r
2025-07-03 15:05:40.745 [info] [Window] [KeybindingService]: | Converted keydown event - modifiers: [], code: KeyR, keyCode: 48 ('R')
2025-07-03 15:05:40.745 [info] [Window] [KeybindingService]: | Resolving ctrl+alt+[KeyO],[KeyR]
2025-07-03 15:05:40.745 [info] [Window] [KeybindingService]: \ From 2 keybinding entries, matched calva.showReplWindow, when: calva:connected && calva:keybindingsEnabled && !calva:outputWindowActive, source: user extension betterthantomorrow.calva.
2025-07-03 15:05:40.745 [info] [Window] [KeybindingService]: + Invoking command calva.showReplWindow.
Shorter Ctrl+R
Failing:
2025-07-03 15:07:52.250 [info] [Window] [KeybindingService]: / Soft dispatching keyboard event
2025-07-03 15:07:52.250 [info] [Window] [KeybindingService]: \ Keyboard event cannot be dispatched
2025-07-03 15:07:52.251 [info] [Window] [KeybindingService]: / Received keydown event - modifiers: [ctrl], code: ControlRight, keyCode: 17, key: Control
2025-07-03 15:07:52.251 [info] [Window] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlRight, keyCode: 5 ('Ctrl')
2025-07-03 15:07:52.251 [info] [Window] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2025-07-03 15:07:52.449 [info] [Window] [KeybindingService]: / Soft dispatching keyboard event
2025-07-03 15:07:52.449 [info] [Window] [KeybindingService]: | Resolving ctrl+[KeyR]
2025-07-03 15:07:52.449 [info] [Window] [KeybindingService]: \ From 1 keybinding entries, matched calva.showReplWindow, when: calva:connected && calva:keybindingsEnabled && !calva:outputWindowActive, source: user.
2025-07-03 15:07:52.449 [info] [Window] [KeybindingService]: / Received keydown event - modifiers: [ctrl], code: KeyR, keyCode: 82, key: r
2025-07-03 15:07:52.450 [info] [Window] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: KeyR, keyCode: 48 ('R')
2025-07-03 15:07:52.450 [info] [Window] [KeybindingService]: | Resolving ctrl+[KeyR]
2025-07-03 15:07:52.450 [info] [Window] [KeybindingService]: \ From 1 keybinding entries, matched calva.showReplWindow, when: calva:connected && calva:keybindingsEnabled && !calva:outputWindowActive, source: user.
2025-07-03 15:07:52.450 [info] [Window] [KeybindingService]: + Invoking command calva.showReplWindow.
2025-07-03 15:07:52.525 [info] [Window] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.
NB: I don't know if the final "Ignoring single modifier ctrl due to it being pressed together with other" is relevant, but it's present when using those same keybindings on bookmark toggling, which works.
Other errors
Not sure if these are related, but here they are:
2025-07-03 15:10:35.933 [error] [Window] Missing mirror document!: Error: Missing mirror document!
at Object.w [as getDocument] (/Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:729579)
at e.getFormSelection (/Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:962675)
at o (/Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:983509)
at c (/Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:983630)
at e.currentClojureContext (/Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:985503)
at /Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:929716
at Generator.next (<anonymous>)
at u (/Users/matthew/.cursor/extensions/betterthantomorrow.calva-2.0.520-universal/out/extension.js:2:928413)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Missing mirror document!
Hi! How do you change the keybinding when trying this? Editing the JSON file or using the Keyboard Shortcuts UI?
The UI. I right-clicked on "Calva: Show/Open REPL Window", chose "Add Keybinding...", entered the bindings, and hit enter.
To see what it generated in VS Code, I opened ~/Library/Application Support/Code/User/keybindings.json, and this was the JSON it added:
{
"key": "ctrl+alt+cmd+r",
"command": "calva.showReplWindow",
"when": "calva:connected && calva:keybindingsEnabled && !calva:outputWindowActive"
}
Still not working, I'm afraid.