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
In MacOS
comment out multi-lines in Visual Studio Code by keyboard shortcut:
Option + Shift + A
/*
...
...
*/
CTRL + / comment / uncomment multiple lines of code
Ctrl+k+u for upper case latter
ctrl+k+l for lower case latter
Select all line you want comments
CTRL + /
To comment multiple line on visual code use
shift+alt+a
To comment single line use
ctrl + /
How to comment out multiline / single line in VS Code:
Shift + Option + A:
/* multiline
comment */
CMD + /:
// single line comment
Shift + Alt + A:
/* multiline
comment */
CTRL + /:
// single line comment
Windows: File > Preferences > Keyboard Shortcuts.
MacOS: Code > Preferences > Keyboard Shortcuts.
You can search through the list both by keybindings (key names) and command names.
Read: How to set shortcuts from another text editor (Sublime, Atom etc)?
Official docs: Key Bindings for Visual Studio Code
First, select the lines you want to comment/uncomment (CTRL+L is convenient to select a few lines)
Then:
To toggle line comments, execute editor.action.commentLine
(CTRL+/ on Windows)
or
To add line comments, execute editor.action.addCommentLine
(CTRL+K CTRL+C)
To remove line comments, execute editor.action.removeCommentLine
(CTRL+K CTRL+U)
or
To toggle a block comment, execute editor.action.blockComment
(SHIFT-ALT-A)
See the official doc : Key Bindings for Visual Studio Code