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

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


当前回答

您可以在官方文档中看到所有可用的键绑定。

这是osx的相关位:

Key     Command

⌘K ⌘C   Add Line Comment    
⌘K ⌘U   Remove Line Comment 
⌘/      Toggle Line Comment 
⇧⌥A     Toggle Block Comment

您需要首先选择想要注释的行,然后执行上述快捷方式,即在osx上执行⌘/ Ctrl/在Windows上。

其他回答

对我来说,它是ctrl + '(我正在使用瑞典键盘布局)。希望这对大家有所帮助。

在Windows中,注释多个的快捷键是shift+alt+A。

visual studio 2017我们做了一个:评论选择

Ctrl + K, Ctrl + C

按Ctrl+K快捷键。按Ctrl+C确认 http://visualstudioshortcuts.com/2017/

MacOS上VSCode的键盘快捷键:https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf

我使用⌘/来切换注释。

您可以在官方文档中看到所有可用的键绑定。

这是osx的相关位:

Key     Command

⌘K ⌘C   Add Line Comment    
⌘K ⌘U   Remove Line Comment 
⌘/      Toggle Line Comment 
⇧⌥A     Toggle Block Comment

您需要首先选择想要注释的行,然后执行上述快捷方式,即在osx上执行⌘/ Ctrl/在Windows上。