If you have setup your computer keyboard to swap caps lock and escape, but it is not working in VS Code, then follow these instructions.

The fix is a simple preference change. Go to Preferences Settings Application Keyboard Dispatch and select keyCode.

After changing the keyboard dispatch logic to keyCode, VS Code will respect your request to swap the caps lock and escape key.

The issue is reported here and here.