如何在 Visual Studio Code 中注释多行?

问题描述:

我找不到在 Visual Studio Code 中注释和取消注释多行代码的方法.

I cannot find a way to comment and uncomment multiple lines of code in Visual Studio Code.

是否可以使用一些快捷方式在 Visual Studio Code 中注释和取消注释多行?如果是,怎么做?

Is it possible to comment and uncomment multiple lines in Visual Studio Code using some shortcut? If yes, how to do it?

Shift+Alt+A

在这里您可以找到所有键盘快捷键.

Here you can find all the keyboard shortcuts.

所有 VSCode 快捷键

PS:我更喜欢 Ctrl+Shift+/ 来切换块注释,因为 Ctrl+/ 是切换行注释的快捷方式,因此自然更容易记住.为此,只需单击屏幕左下方的设置图标,然后单击键盘快捷键"并找到切换块...".然后点击并输入您想要的组合.

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.