Multiline comments in VS Code

Viewed 12994

I want to comment out my code in this style

/**
 * This is
 * A multiline comment
 */

Is it possible to do with a shortcut?

EDIT 1:

https://github.com/Microsoft/vscode/issues/50301 Address this issue, however it does not work with a shortcut. I want to be able to select a block of code and comment it out in the style above

5 Answers

How to comment out multiline/single line in VS Code:

  • macOS:

    Shift + Option + A

  • Windows And Linux core:

    Shift + Alt + A

How to remap/change these shortcuts?

Windows : File > Preferences > Keyboard Shortcuts.

MacOS : Code > Preferences > Keyboard Shortcuts.

You can search through the list both by keybindings (key names) and command names.

The shortcut is shift + alt + a (windows), Not sure about mac.

This isn't a real solution, but you can make the /* ... */ style comments with Shift + Option/Alt + A, and then use the vertical cursor select to insert a space and asterisk at the beginning of each line.

Select the bulk line list first, then hit below key strokes. You can reverse the operation by executing same.

Windows: Ctrl + /

Mac: Command + /
Related