我知道Xcode有一个
#pragma mark
功能,它允许您在大纲视图/方法列表中插入任意标签,以记录代码的分段方式。
我无法为Eclipse找到类似的功能。我不禁觉得它在我的鼻子底下,但对SO和谷歌的搜索都没有启发......有谁知道我会怎么做?
或者有一些hackish解决方法?那也很棒。
答案 0 :(得分:29)
Eclipse大纲视图支持类别(在javadoc中使用@category)以显示有关方法的其他信息。有关此类用法的示例,请参阅以下屏幕截图。
不幸的是,按类别分组尚未实施。这有一个open feature request,但它已有近四年的历史,并明确表示需要社区努力。我个人不知道这样的插件。
答案 1 :(得分:9)
恐怖:
@SuppressWarnings("unused")
private int _______________________________________;
或者如果你喜欢标签:
@SuppressWarnings("unused")
private int _______________Lifecycle_______________;
用于改变下划线数量的加分点,因此您可以有许多分隔线。
我的Android Studio版本
使用代码区域:
//region
... your code here ...
//endregion
使折叠的演示文稿看起来像评论的加分点:
//
//region // Lifecycle
... your code here ...
//endregion
//
答案 2 :(得分:4)
您可以使用“添加书签”。
一种方法是右键单击左侧(显示行号),然后选择“添加书签...”。
您可以在“书签”视图中查看它们。
答案 3 :(得分:4)
为了模仿#pragma mark
功能,我通常会创建一个用作分隔符的虚方法。例如:
private static void someDummyMethod(){}
答案 4 :(得分:0)