I cannot find a way to comment and uncomment multiple lines of code in Visual Studio Code.
Is it possible to comment and uncomment multiple lines in Visual Studio Co
You can view the existing shortcuts using the same steps as below. I find the default ones to be inconvenient, so I used the following process to change the IDE to use the '/' command seen in the comments.
You can customize the keyboard shortcuts by going int the "Tools" menu and selecting "Options". Then select "Keyboard" from the "Environment" branch. From there you can bind the Edit.CommentSelection and Edit.UncommentSelection commands to whichever keyboard shortcuts you'd like.
For windows, the default key for multi-line comment is Alt + Shift + A
For windows, the default key for single line comment is Ctrl + /
If you are using VSCode in a linux environment, then you can comment multiple lines by either:
Selecting a block of code => then, press Ctrl + Shift + A (Block commenting)
Or, selecting a block of code => then, press Ctrl + / (Single-line commenting applied to all selected lines)
Hope this helps.
Multi-Line Comment in VS Code
To comment the code select the lines and hit: Alt + Shift + A
To Uncomment select the commented code and hit: Alt + Shift + A
In Windows
Select the lines you want to comment. Then press Ctrl + /
Shift+Alt+A
Here you can find all the keyboard shortcuts.
All VSCode Shortcuts
PS: I prefer Ctrl+Shift+/ for toggling block comments because Ctrl+/ is shortcut for toggling line comments so it's naturally easier to remember. To do so, just click on the settings icon in the bottom left of the screen and click 'Keyboard Shortcuts' and find "toggle block...". Then click and enter your desired combination.