提问者:小点点

如何折叠Visual Studio code for Windows中的代码段?


如何在Visual Studio代码中折叠或折叠代码节?

是否支持此功能?


共3个答案

匿名用户

自Visual Studio代码版本0.10.11以来,折叠已经推出并现已实现。有以下键盘快捷键可用:

>

    Windows和Linux/LI>上的++ MACOS/LI上的++

展开在光标处展开折叠的区域:

    Windows和Linux/LI>上的++ MACOS/LI上的++

折叠所有折叠编辑器中的所有区域:

    Windows和Linux/LI>上的+(KBDK/KBD>=&>)(零) MACOS/LI>上的+(KBDK/KBD>=&>)(零)

全部展开在编辑器中展开所有区域:

    Windows和Linux/LI>上的+(KBDK/KBD>=&>) MACOS/LI上的+(KBDK/KBD>=&>)

引用:https://code.visualstudio.com/docs/getstarted/keybindings

匿名用户

从Visual Studio代码版本1.12.0(2017年4月)开始,请参见基本编辑&>;在文件中折叠部分。

默认键为:

全部折叠:(零)

折叠级别[n]:

全部展开:

折叠区域:

展开区域:

*折叠级别:要折叠除最外类以外的所有内容,请尝试

MACS:使用而不是(谢谢Prajeet)

匿名用户

按区域进行代码折叠的版本是V1.17。按区域折叠文档。以及V1.19和1.23。

[通常,您可以向添加一个空格,例如,它也可以工作。]

TypeScript/JavaScript: //#region and //#endregion or // #region and // #endregion
C#:                    #region and #endregion
C/C++:                 #pragma region and #pragma endregion
F#:                    //#region and //#endregion
PowerShell:            #region and #endregion
Python:                #region and #endregion
VB:                    #Region and #End Region
PHP:                   #region and #endregion
Bat:                   ::#region and ::#endregion or REM #region and REM #endregion
Markdown:              <!-- #region --> and <!-- #endregion -->
Golang                 //region and //endregion or //#region and //#endregion
Java                   //#region and //#endregion
CSS/SCSS/Less:         /* #region */ and /* #endregion */ or /*#region*/ and /*#endregion*/
SCSS/Less:             // #region and // #endregion
Go:                    // region, // endregion and // #region, // #endregion
shellscript:           # region and # endregion
Perl5                  #region and #endregion or =pod and =cut`

重要提示:如果您在列表中没有看到您的语言::

每种语言都有标记可用的片段。键入“。”并调用代码完成来查看它们。若要为您的语言配置区域标记,请与语言扩展提供程序联系。

因此键入,然后键入以查看任何语言的区域标记。