我想在Eclipse中使用区域进行代码折叠;在Java中怎么做到呢?
c#中的一个例子:
#region name
//code
#endregion
我想在Eclipse中使用区域进行代码折叠;在Java中怎么做到呢?
c#中的一个例子:
#region name
//code
#endregion
当前回答
在Visual Studio Code中,尝试这样做:
//region Variables
// Code you need
//endregion
其他回答
只需安装并启用Coffee-Bytes插件(Eclipse)
没有这样的标准对等物。一些ide(例如Intellij或Eclipse)可以根据所涉及的代码类型(构造函数、导入等)进行折叠,但没有像#region这样的ide。
在语言中没有对应的…基于ide…
例如在netbeans中:
NetBeans/Creator支持以下语法:
// <editor-fold defaultstate="collapsed" desc="Your Fold Comment">
...
// </editor-fold>
http://forums.java.net/jive/thread.jspa?threadID=1311
与大多数人所发布的相反,这不是一个IDE的事情。这是语言问题。区域是一个c#语句。
自定义代码折叠功能可以使用CoffeeScript代码折叠插件添加到eclipse。
这已被测试用于月食Luna和Juno。以下是步骤
Download the plugin from here Extract the contents of archive Copy paste the contents of plugin and features folder to the same named folder inside eclipse installation directory Restart the eclipse Navigate Window >Preferences >Java >Editor >Folding >Select folding to use: Coffee Bytes Java >General tab >Tick checkboxes in front of User Defined Fold Create new region as shown: Restart the Eclipse. Try out if folding works with comments prefixed with specified starting and ending identifiers
你也可以在这个博客上下载存档和查找步骤。