//region Description
Some code
//endregion
option
+ command
+ T
。 - Hurricane没有类似的标准等效物。例如,Intellij或Eclipse等IDE可以根据涉及代码类型(构造函数、导入等)来折叠,但是没有类似于#region
的东西。
使用Android Studio,尝试以下操作:
//region VARIABLES
private String _sMyVar1;
private String _sMyVar2;
//endregion
请注意://region ...之后不要留空行。
这样你会得到:
在语言中没有相对应的...基于IDE...
例如在NetBeans中:
NetBeans/Creator支持此语法:
// <editor-fold defaultstate="collapsed" desc="Your Fold Comment">
...
// </editor-fold>
使用CoffeeScript代码折叠插件,可以为Eclipse添加自定义代码折叠功能。
此方法经过了Luna和Juno版本的Eclipse测试。以下是步骤:
从这里下载插件。
提取存档内容。
重启Eclipse。
导航 Window >Preferences >Java >Editor >Folding >Select folding to use: Coffee Bytes Java >General tab >Tick checkboxes in front of User Defined Fold
按如下所示创建新区域:
重新启动Eclipse。
尝试使用指定的起始和结束标识符前缀的注释进行折叠操作。
您也可以从此博客下载存档并查找步骤。
这更像是一个IDE功能而不是语言功能。Netbeans允许您使用以下定义来定义自己的代码折叠规则:
// <editor-fold defaultstate="collapsed" desc="user-description">
...any code...
// </editor-fold>
如文章所述,其他编辑器可能也支持此功能,但不能保证。突出显示
您想要包围的代码ctrl
+ alt
+ t
c
==> 然后输入说明 与大多数人发布的内容相反,这不是一个 IDE 问题。这是一种语言问题。#region 是 C# 语句。