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

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


当前回答

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

Ctrl + K, Ctrl + C

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

其他回答

在windows中,您需要按ctrl + /在mac中,您可以使用⌘+ /进行多个注释

// public function index()
// {
//     $badgeIcon = BadgeIcon::all();
//     return $this->showAll($badgeIcon);
// }

然后如果你想取消注释,那么再次选择这些行,然后再次按ctrl + /(在windows中)⌘+ /(在mac中)。

在MacOS中,用键盘快捷键注释掉Visual Studio Code中的多行代码:

选项+ Shift + A

/*
...
...
*/

Or,

选择所有行,然后按CTRL + /

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

这是osx的相关位:

Key     Command

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

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

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

在Windows 10中,你可以使用CTRL +}对任何一行或代码块进行注释/取消注释。