Eclipse 的代码折叠插件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6872921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Code folding plugin for Eclipse?
提问by Axonn
I dislike Eclipse's code folding feature, because the folding state isn't saved when you close the file, like Visual Studio does with its #region
directives.
我不喜欢 Eclipse 的代码折叠功能,因为关闭文件时不会保存折叠状态,就像 Visual Studio 对其#region
指令所做的那样。
Does anyone know of a plugin which saves the status of the code folding per file, so that when I open it, the code stays folded?
有谁知道一个插件可以保存每个文件的代码折叠状态,这样当我打开它时,代码保持折叠状态?
采纳答案by Oleksandr Kucherenko
Try to use: http://code.google.com/p/coffee-bytes/
尝试使用:http: //code.google.com/p/coffee-bytes/
You have to download the source code, import project into Eclipse and build it. After that Export code as a deployable plug-in for Eclipse. You will have a package for installation.
您必须下载源代码,将项目导入 Eclipse 并构建它。然后将代码导出为 Eclipse 的可部署插件。您将有一个安装包。
- Install it into Eclipse.
- Go To Eclipse Preferences...
- Type in search "Folding"
- Select Jave->Editor->Folding
- Select in ComboBox "Coffee Bytes Java Folding"
- On General Tab set checkbox - "User Defined Regions"
- In User Defined Regions tab - enter #region as a start tag and #endregion as an end tag
- 将其安装到 Eclipse 中。
- 转到 Eclipse 首选项...
- 输入搜索“折叠”
- 选择 Jave->Editor->Folding
- 在组合框中选择“Coffee Bytes Java Folding”
- 在常规选项卡设置复选框 - “用户定义的区域”
- 在用户定义的区域选项卡中 - 输入 #region 作为开始标记和 #endregion 作为结束标记
In code folding will be available after setting special comments into it:
在代码中设置特殊注释后可以折叠:
// #region
... some code ...
// #endregion
回答by RainSia
If you are using CDT plugin for eclipse (which means you use C/C++ as your programming language), you may find this is very helpful:
如果您正在为 Eclipse 使用 CDT 插件(这意味着您使用 C/C++ 作为您的编程语言),您可能会发现这非常有帮助:
http://syncor.blogspot.com/2011/02/folding-c-code-regions-in-eclipse.html
http://syncor.blogspot.com/2011/02/folding-c-code-regions-in-eclipse.html
don't know if Java has a similar feature
不知道Java有没有类似的功能