So, I recently installed Visual Studio Code(1.40.0) on Windows 10. Everything was working fine as I was working around to see how to run Python Code, I installed Python extension, pylint, Auto PEP-8 formatter, code-runner extension and I was being able to run code just fine using keyboard shortcut Ctrl-Alt-N. Then I also tried to see if I could use MSVC compiler to run C code and it wasn't to my satisfaction of VSCode, but then all of a sudden the keyboard shortcut to run code stopped working.
Now if I press Ctrl-Alt-N, all it gives in the editor window, is this symbol 'ṇ'.
I have tried reinstalling VSCode, deleting base configuration files(.json), reinstalling python extension, but problem still persists. One more thing I was thinking about was that I updated pip from the VS terminal, but I am not sure if it was at that point that the shortcut stopped working. I can run code fine using the run code icon or from command bar, but cannot do the same with the shortcut. Can anyone help out?
Update: I even tried re-configuring the keyboard shortcut, but it won't take Ctrl-Alt-N from the user, it defaults to 'n'.
5 Answers
Steps to fix:
- Go to 'Advanced keyboard settings'. Ensure the drop-down menu option under 'Override for default input method' is set to 'Use language list (Recommended)'.
- Go to 'Language settings', Make sure under 'Preferred languages', first option is set to 'English (United States)'. Click on it. Click on 'Options'.
- Under 'Keyboards', remove whatever keyboard is there, and add 'US' keyboard instead.
It should be fixed now.
I believe the offending keyboard is 'English (India)', because the 'ṇ' character (and you can produce other such 'weird' characters with Ctrl+Alt+) is a Devanagari transliteration character used to write phonetically correct Devanagari words in Romanized form.
You are not the only one. See the following bug reports:
- run code hotkey (ctrl + alt + n) doesn't work #286
- Some Ctrl+Alt shortcuts no longer work #68787
- Running Code from Keyboard Shortcut (Ctrl+Alt+N) doesn't work as expected #375
The fixes that worked for some people:
- Rebooting the computer was the simplest fix
- Assigning this command another key-combination (link)
Make sure to select English US Keyboard. To change the type of the keyboard press (win+space) and select English US Keyboard and then (ctrl+alt+n) will run the code.
- GO to File -> preferences -> Keyboard Shortcuts and open it.
- Search for code runnersomething like thisenter image description here
3.Then click on the pencil icon and change the shortcut key to anything suitable for you !!
You need to install/re-install the Code Runner extension otherwise you have to manually select a debugger all the time you hit run...