如何在Visual Studio Code中折叠或折叠代码部分?
这个功能支持吗?
这个功能支持吗?
Fold All (Ctrl+K Ctrl+0) folds all regions in the editor.
Unfold All (Ctrl+K Ctrl+J) unfolds all regions in the editor.
Fold Level X (Ctrl+K Ctrl+2 for level 2) folds all regions of level X, except the region at the current cursor position.
#region Function Write-Log
Function Write-Log {
...
}
#endregion Function Write-Log
目前,Visual Studio Code忽略它并不会折叠它。而Notepad++和PowerGUI可以很好地处理这个问题。
更新:我刚刚注意到Visual Studio Code的一个更新。现在已经支持这个功能了!
或者,如果你想要去掉折叠按钮,以获得额外的空间:
"editor.folding": false
(添加到您的settings.json
文件中)
"editor.foldingMaximumRegions": 5000
更多信息请参见:区域扩展https://marketplace.visualstudio.com/items?itemName=maptz.regionfolder
安装扩展并使用Python后,它的工作方式如下:
# region ARBITRARY_REGION_NAME
code goes here...
# endregion
如果你遇到了类名因为◦◦◦
或者...
而被折叠的问题,那可能是由于像这样与Tailwind相关的扩展造成的:
这些扩展会折叠class
,因为Tailwind CSS可能会重复和冗长,所以这些扩展可以帮助折叠这些类名,从而使其变得更加简洁。
<div class="some class names here"></div>
转换为:
<div class="..."></div>
VSCode 扩展可以修改代码的行为,例如格式和显示,因此最好检查您的扩展列表,并确保没有任何一个引起了意外的副作用。禁用它们并再次尝试,看看是否解决了您的问题。