Making VSCode respect Linux key rebindings

Im using VSCode with vim-mode ALOT. So for the comfort of not having to stretch my fingers too much I have decided to switch my ESC and Capslock key.
Unfortunately though, VSCode did not seem to respect any of the changes that I had made via the gnome-tweak-tool.

AFTER WRITING IN ALL CAPS MULTIPLE TIMES I figured I should get to the bottom of this.


This is something that might be broken by us dispatching based on scan codes. I am sorry about it, I need some time to investigate how these options should be handled. i.e. should Chromium handle these mappings or should we do it at the application layer.

Workaround to switch VS Code to dispatch based on key code again. Add the following setting:
“keyboard.dispatch”: “keyCode” and restart VS Code

ScanCodes vs KeyCodes

So what exactly does this mean?
Its really quite simple.

A ScanCode is what you OS will scan from the keyboard hardware. So if ScanCodes are the default in VSCode it will always use the keys are actually printed onto my hardware keyboard.

The KeyCode on the other hand is the code that the OS will send to VSCode. Since I have remapped the keys through gnome this is actually the setting that I would want to use.

&& it works. Just setting this small configuration let me go back into my usual coding routine.

If you want to learn more about this and maybe even prove me wrong ( I havent read about this topic exhaustively, just enough to wrap my head around it ) you can find more info on this stackoverflow answer or this microsoft documentation page.

Back to overview