向 Eclipse Outline 视图添加分隔符(如 #pragma mark)

发布于 2024-08-23 00:49:57 字数 220 浏览 3 评论 0原文

我知道 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

旧故 2024-08-30 00:49:57

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.

Category definition in the editor

Category and filtering in the Outline view

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.

浮云落日 2024-08-30 00:49:57

恐怖:

@SuppressWarnings("unused")
private int _______________________________________;

或者,如果您更喜欢标签:

@SuppressWarnings("unused")
private int _______________Lifecycle_______________;

在此处输入图像描述

改变数字的奖励积分下划线,这样你就可以有很多分隔线。


我的 Android Studio 版本

使用代码区域:

//region

    ... your code here ... 

//endregion

使折叠演示文稿看起来像注释的奖励积分:

//
//region // Lifecycle

   ... your code here ...

//endregion
//

在此处输入图像描述

The horror:

@SuppressWarnings("unused")
private int _______________________________________;

Or if you prefer labels:

@SuppressWarnings("unused")
private int _______________Lifecycle_______________;

enter image description here

Bonus points for varying the number of underscores so you can have many separator lines.


My Android Studio Version

Use code regions:

//region

    ... your code here ... 

//endregion

Bonus points for making the folded presentation look like a comment:

//
//region // Lifecycle

   ... your code here ...

//endregion
//

enter image description here

遥远的她 2024-08-30 00:49:57

您可以使用“添加书签”。

一种方法是右键单击左侧(显示行号的位置),然后选择“添加书签...”。

您可以在“书签”视图中查看它们。

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.

北陌 2024-08-30 00:49:57

为了模仿#pragma mark 功能,我通常创建一个充当分隔符的虚拟方法。例如:

private static void someDummyMethod(){}

In order to mimic the #pragma mark functionality I usually create a dummy method that works as a separator. For example:

private static void someDummyMethod(){}
时光磨忆 2024-08-30 00:49:57

从 2022 年 6 月左右开始,Eclipse CDT 原生支持#pragma mark。

#pragma mark Public API       // Inserts a bold title
#pragma mark - Public API     // Inserts a line above a bold title
#pragma mark - Public API -   // Inserts a line above and below a bold title
#pragma mark -                // Inserts a line

#pragma mark is supported natively in Eclipse CDT as of about 2022-06.

#pragma mark Public API       // Inserts a bold title
#pragma mark - Public API     // Inserts a line above a bold title
#pragma mark - Public API -   // Inserts a line above and below a bold title
#pragma mark -                // Inserts a line
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文