In Google Chrome's devtools you can toggle comments with the shortcut:
Ctrl + /
On a keyboard with a Swedish layout this doesn't work as the / on an English keyboard is replaced with -, causing the text to zoom out instead.
Other combinations based on the position of / on the Swedish keyboard doesn't work either.
How to make it possible to toggle comments on non-english keyboard layouts?
There is a bug with some shortcuts that require to press a modifier key on non-english keyboard. Follow this issue for the resolution.
Edit : I looked at the swedish keyboard layout. While the bug is still present, press Ctrl + *, this will send the code awaited for toggling comments (keycode 191)
Related
This tells me that I could use ⌃ + Space combination in order to display suggestions for my code. However, ctrl + Space ( ^ key is ctrl as far as I know) only seems to change the input language keyboard in my system. Nothing else seems to work.
Try Option + Escape, on mac.
The mac keyboard shortcut ctrl + space for switching input sources overrides the VSCode one. Because of this, VSCode added a new keybinding just for mac, Option + Escape
This is actually called intellisense, and the new keyboard shortcut was added in the November 2019 update.
You can disable the macOS shortcut in System Preferences → Keyboard → Shortcuts.
Alternatively you can set up a custom keybinding for this command in VS Code, so that it no longer conflicts with your system shortcut. Please refer to the official documentation.
Recently, ⌘I (i.e. command + i) is also a by default key binding for triggering suggestions.
On MacOS Ventura,
Go to System Settings
Select Keyboard on the Left panel
Select "Keyboard Shortcuts"
Select Input Sources and toggle the switch labelled "Select the previous input source".
Quit vscode and relaunch
I know how to do it on Mac, Linux and Windows, but it doesn't work on Chromebook. You'd expect it to be alt-up/down like Win/Linux, but that is treated like home and end.
Anybody know the trick?
Alt + Up/Down and Ctrl + Alt + Up/Down are reserved by Chromebook. You could open File --> Preferences --> Keyboard Shorcuts in VS Code and change Move Line Up/Down settings to something else.
Chromebook keyboard shortcuts
Chromebook keyboard shortcuts image
There's a easy way.
Just open google-chrome and type chrome://flags in the URL bar,go to the Experiments page.
Search Deprecate Alt based six-pack , then Enable this feature.
Restart.
Then you can use the default shortcut to move line up/down in VSCode.
I encountered an issue with toggle comment in visual studio code on Ubuntu. Default hot key was "ctrl+/", it didn't respond when I click on a line of code or highlighted the line of code. I changed the hot key to "ctrl+l" under preference -> Keyboard Shortcuts and it didn't respond too.
I tried to google this but nobody seems to encounter this issue or posted this question.
Is there something else I need to enable to make this work?
In my case it was due to the fact that VS Code 'didn't know' the language the file was written in. I was editing a .cmake file and VS Code does not 'understand' CMake syntax when installed out-of-the-box.
Installing a 'CMake' extension enabling CMake syntax highlight also enabled the 'Toggle Line Comment' [Ctrl+/] shortcut to work.
(I'm guessing without the specified language VS Code simply does not know which symbol to use to comment out the lines - e.g. '//' or '#' or else).
This the issue because in ctrl + /
/ -> is numpad divide
or
/-> simple / the key not present in numpad
so if you try any of these combinations one will definitely work, if u want to work with numpad one only you can go to
File-> Preferences -> Keyboard shortcuts (there search for toggle line comment and give your own shortcut)
For me, in VSCode has a error with ctrl + } and ctrl + shift + } 'cause is inversly and no show correctly the keys to hit.
You must redirect to Keyboard Shortcuts - Visual Studio Code, and search the shortcut "Comment", and hit:
blockComment: Insert ctrl + } when you hit ctrl + shift + }.
commentLine: Insert ctrl + shift + } when you hit ctrl + }.
The Shortcuts show like this
I hope that help for you.
That how I solved it. Open File/Preferences/Keyboard Shortcuts or type ctrl+K ctrl+S VSCode preferences. Then click {} button in the top-right corner. In the last version on Sep 16, 2019, it looks like a file with the arrow. Now you see keybindings.json, at the bottom there is a button Define keybindings - click and type in the form there "Ctrl+/" It will show you all commands with your combination. I found and commented the one from Emmet
` {
"key": "ctrl+/",
"command": "editor.emmet.action.toggleComment",
"when": "editorTextFocus && !editorReadonly"
},`
There was a conflict.
I had the same problem and I didn' found the answer in the internet, but eventually I found it on my own.
My system is Linux Mint and my computer is a Thinkpad 440p with an brazilian Portuguese keyboard. This keyboard doesn't have a Right Control key, and then key usually associated with it is used for slash (/) and interrogation mark if pressed with shift. Mint has a good driver for it, mapping it to the correct symbol. I have never had issue with any other code editor or software.
However VSCode by default bypass this keymap done by the system and uses raw code com from keyboard hardware. This can be changed in setting, keyboard dispatch. I change it from "code" to "keymap" and then it worked like a charm.
I know the default keyboard shortcuts of folding&expanding editor and how to rebind them.
But whatever the shortcut I've set didn't take effect.
I rebound the folding keyboard shortcut with "Ctrl + -" , "Ctrl + i" , even " - ".
But when I press the keys nothing happened.
If I should set something else?
Oh yeah~ , I solved it..
Maybe this problem only happened to me, anyhow Share to everyone~:
The collapse defauty keyboard shortcut is "Ctrl+Numpad_Subtract"
Previously, I rebound it with "Ctrl+Numpad_Subtract, Ctrl+-".
I think both the "Ctrl+Numpad_Subtract" and the "Ctrl+-" can use.
Actually, only one can use.
(Why did I use the "Ctrl+Numpad_Subtract" directly? Because my notebook has no numeric keyboard)
I believe this problem has been present for a few years in Netbeans, in different non-English keyboard layouts (see for example Shortcuts in NetBeans don't work).
Premises:
I am using Netbeans 7.3.1, and coding in Java
I use a non-US keyboard layout (Swedish), and Netbeans picks up all the Swedish keys correctly when typing them in the code window.
The problem:
The keyboard shortcuts that use keys that are mapped the same in Swedish and English layout (normal letters for example) work fine, but the keyboard shortcuts that use keys that are mapped differently behave inconsistently.
Example:
Toggle comment (Ctrl+Slash). Slash is Shift+7 in Swedish layout, Ctrl+Shift+7 brings up project properties. Slash in US layout is the key left of right shift, labeled - in Swedish layout. If I press that, Netbeans recognizes this as - and performs the standard behavior for Ctrl+- (a code fold).
Complete line (Ctrl+Shift+;). The key labeled ; in Swedish layout has < in US. This combo brings upp the bookmarks tab. The key labeled ; in US layout has a Swedish letter, this combo does nothing.
I have seen questions by people in different languages asking about one specific shortcut or another not working, and the answer is usually to edit the Netbeans keymap, I wanted to connect a few more dots. Does anybody have further experience or suggestions?
Another shortcut appearing on the keyboard shortcuts card for for 7.3.1 that this affects is Move caret to matching brace (Ctrl+[).
These issues have been around since at least 2008: https://netbeans.org/bugzilla/show_bug.cgi?id=155117. As of last year, the developers seem undecided if it is worthwhile to fix: https://netbeans.org/bugzilla/show_bug.cgi?id=227247
However -
Toggle comment has an alternative shortcut - Ctrl+Shift+C - originally aimed at German keyboards, but which should work for all remotely mainstream layouts since it uses no special key.
Move caret to matching brace apparently has the alternative Ctrl+^ aimed at French layout, but does not work in Swedish for example.
Complete line has no alternative I could find.
Conclusion
Personally I will be using Ctrl+Shift+C for comments, and entering my own alternative for Complete line in Options > Keymap. Move caret to matching brace / bracket, though named on the shortcuts card, does not show up as a reassignable here as far as I can see.
I had this problem too and it had a simple solution and the solution was the font change.
In Netbeans (tool-option-font&زcolor-font). I changed my default font.