I am trying to get the keybind for adding new cursors to work in Visual Studio Code (Ctrl+Alt+DownArrow / UpArrow). Currently pressing this combination of keys has no obvious effect, but is listed in my command palette as creating new cursors (and selecting the option from the command palette works as expected).
Therefore I am wondering if there is an easy way to work out why it isn't working, for example an output of what key combinations the editor receives and what commands it carries out on receiving a key combination?
Here is the command I am referring to (note that selecting it from palette works as shown),
You can troubleshoot keybindings by opening the Command Palette and selecting Developer: Toggle Keyboard Shortcuts Troubleshooting
You can read more in the VS Code documentation,
To troubleshoot keybindings problems, you can execute the command Developer: Toggle Keyboard Shortcuts Troubleshooting. This will activate logging of dispatched keyboard shortcuts and will open an output panel with the corresponding log file.
You can then press your desired keybinding and check what keyboard shortcut VS Code detects and what command is invoked.
I fixed my original issue by bringing up the dev tools in VSCode (Help > Toggle Developer Tools) and noticing the warning:
"Ctrl+Alt+ keybindings should not be used by default under Windows."
This was being thrown by a package unrelated to multi-cursor but highlighted the issue. It simply seems that you cannot use keybinds of that type under Windows, though I could not find any documentation on reserved Windows keybindings.
For debugging keybinds I ended up pulling down the vscode source and there is a promising looking interface IKeybindingService
. I imagine a break-point in the lookupKeybindings
function on a class implementing this interface would be useful for debugging keybinds, but having fixed my original issue I am not looking any further into this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With