如何在 Eclipse 中显示当前函数

发布于 2024-08-06 19:32:34 字数 94 浏览 5 评论 0原文

我怀念 Eclipse 中的某些功能。我想知道光标当前所在的当前函数的名称。例如,当使用搜索功能浏览未知代码时,这非常有用。

知道如何展示吗?也许是一个插件?

I miss a certain functionality in Eclipse. I would like to know the name of the current function the cursor is currently inside. This is useful when browsing unknown code using the search function, for example.

Any idea how to show it? Maybe a plugin?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(9

秉烛思 2024-08-13 19:32:34

我正在使用工具栏中的“切换面包屑”选项:

Eclipse Breadcrumb button

它显示了一个漂亮的面包屑,以当前函数结尾姓名。

这对我来说非常方便,因为如果你有无数的函数,Outline 使用起来就会很麻烦。

它会在 Java 编辑器上方生成以下结构(在下图中截断):

Eclipse Breadcrumb path

I'm using the "Toggle Breadcrumb" option from toolbar:

Eclipse Breadcrumb button

It shows a nice breadcrumb, ending with current function name.

It's quite handy for me, as Outline becomes cumbersome to use if you have zilions of functions.

It produces the following structure above your Java Editor (truncated at the picture below):

Eclipse Breadcrumb path

绝不放开 2024-08-13 19:32:34

“大纲”视图显示当前功能。

输入图片此处描述

可能需要在大纲视图下拉菜单中启用“链接到编辑器”选项。对于 CDT,此功能可能默认处于关闭状态。

The "Outline" view shows the current function.

enter image description here

It may be necessary to enable the 'Link to Editor' option in the Outline View dropdown menu. This might be off by default for CDT.

烟凡古楼 2024-08-13 19:32:34

我一直在寻找类似的东西(顶部类似 Xcode 的栏显示当前函数,您也可以通过单击它打开函数的弹出列表来转到另一个函数)。这是我对 Eclipse 3.5.1 CDT 的决定:

我将 Outline 视图移至顶部,调整其大小以使其成为 1 行水平条带(不要使其太窄),并在其菜单中选择“与编辑器链接”,以便它始终显示当前功能。但是,这不会像 Xcode 那样打开弹出列表。对于该功能,我为“显示大纲”命令分配了一个快捷方式,该命令会打开所有功能的弹出列表。

I was looking for something similar (Xcode-like bar at the top showing the current function, where you can also go to another function by clicking on it to open a popup list of functions). Here is what I settled on with Eclipse 3.5.1 CDT:

I moved the Outline view to the top, resized it to make it a 1-line horizontal strip (don't make it too narrow), and selected "Link With Editor" in its menu, so that it always shows the current function. However, this doesn't open a popup list like Xcode. For that functionality, I assigned a shortcut to the "Show Outline" command which does open a popup list of all functions.

听风吹 2024-08-13 19:32:34

Eclipse 功能“显示轮廓”将弹出轮廓对象列表,并且将以灰色突出显示光标所在的对象。它通常绑定到“ctrl-o”(字母“o”,而不是零),但您可以根据需要重新绑定它。我正在使用 CDT 插件运行 Eclipse,它对我来说工作得很好。

The Eclipse function 'show outline' will pop up a list of outline objects, and it will highlight the object your cursor is inside in grey. It's typically bound to 'ctrl-o' (the letter 'o', not zero), but you can re-bind it as you see fit. I'm running Eclipse with the CDT plugin and it works pretty well for me.

岁月如刀 2024-08-13 19:32:34

要启用面包屑导航,请调用工具栏中的“切换 Java 编辑器面包屑导航”或在 Java 编辑器中按 Alt+Shift+B

To enable the breadcrumb invoke Toggle Java Editor Breadcrumb in the toolbar or press Alt+Shift+B in the Java editor.

眼眸 2024-08-13 19:32:34

您还可以显示快速大纲 (ctrl+o)。这样您就可以快速查看上下文,而无需将永久大纲窗口链接到编辑器。

You can also display the Quick Outline (ctrl+o). This way you see the context quickly without having to have a permanent Outline Window linked to the Editor.

冰火雁神 2024-08-13 19:32:34

使用大纲菜单上的“与编辑器链接”选项

Use the "Link With Editor" option on the outline menu

灯下孤影 2024-08-13 19:32:34

按 Ctrl+o(光标当前位于函数内的特定行)。

如果光标位于方法主体之外,它会突出显示当前方法或类的名称。
您可以单击突出显示的方法。

它具有内联搜索功能...开始输入方法名称以导航到指定的方法或具有匹配搜索模式的方法。

如果再次按 Ctrl+o 将显示继承的成员/方法。

Press Ctrl+o (cursor is currently inside a function at a particular line).

It highlights the current method, or name of the class if the cursor is outside the method body.
You can click on highlighted method.

It has got inline search feature ...start typing name of the method to navigate to the specified method or method with matching search pattern.

If you press again Ctrl+o to shows the inherited members/methods.

飘然心甜 2024-08-13 19:32:34

使用大纲和“与编辑器链接”选项也对我有用,谢谢!
另外,您可以将大纲窗格移动到与搜索、进度等相同的窗口组中,从而节省视角中的空间,而不是将其保留在另一个组中。

Using outline with "link with editor" option worked also for me, thanks!
Just an addition, you can move outline pane in to the same window group as search, progress etc. saves the space in your perspective instead of keeping it at another group.

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