向 Eclipse Outline 视图添加分隔符(如 #pragma mark)
我知道 Xcode 有一个
#pragma mark
功能,它允许您在大纲视图/方法列表中插入任意标签来记录代码是如何分段的。
我还没有找到 Eclipse 的类似功能。我情不自禁地觉得它就在我眼皮子底下,但是在 SO 和 Google 上的搜索都没有启发……有人知道我该怎么做吗?
或者有一些黑客的解决方法吗?那也太棒了。
I know Xcode has a
#pragma mark
feature where it allows you to insert arbitrary labels in outline views / method lists to document how code is segmented.
I haven't been able to find a similar feature for Eclipse. I can't help but feel that it's right under my nose, but searches on both SO and Google haven't been enlightening... anyone know how I might do this?
Or is there some hackish workaround? That would be awesome too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Eclipse 大纲视图支持类别(在 javadoc 中使用 @category)来显示有关方法的附加信息。有关此类用法的示例,请参阅以下屏幕截图。
不幸的是,按类别分组尚未实现。有一个针对此的开放功能请求,但已经近四年了老并明确指出它需要社区的努力。我个人不知道这样的插件。
Eclipse outline view supports categories (with @category in javadoc) for showing additional information on methods. See the following screenshots for an example of such usage.
Unfortunately grouping by categories has not been implemented yet. There is an open feature request for this, but it is nearly four years old and clearly stated that it needs community effort. Personally I do not know such plugin.
恐怖:
或者,如果您更喜欢标签:
改变数字的奖励积分下划线,这样你就可以有很多分隔线。
我的 Android Studio 版本
使用代码区域:
使折叠演示文稿看起来像注释的奖励积分:
The horror:
Or if you prefer labels:
Bonus points for varying the number of underscores so you can have many separator lines.
My Android Studio Version
Use code regions:
Bonus points for making the folded presentation look like a comment:
您可以使用“添加书签”。
一种方法是右键单击左侧(显示行号的位置),然后选择“添加书签...”。
您可以在“书签”视图中查看它们。
You can use "Add Bookmark".
One way to do that is to right-click on the left side (where line numbers are shown), and select "Add Bookmark...".
You can view them in "Bookmarks" view.
为了模仿#pragma mark 功能,我通常创建一个充当分隔符的虚拟方法。例如:
In order to mimic the
#pragma mark
functionality I usually create a dummy method that works as a separator. For example:从 2022 年 6 月左右开始,Eclipse CDT 原生支持#pragma mark。
#pragma mark is supported natively in Eclipse CDT as of about 2022-06.