How to Display Current Function in Eclipse

馋奶兔 提交于 2019-12-09 07:43:16

问题


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?


回答1:


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

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):




回答2:


The "Outline" view shows the current function.

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.




回答3:


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.




回答4:


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.




回答5:


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




回答6:


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.




回答7:


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




回答8:


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.




回答9:


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.



来源:https://stackoverflow.com/questions/1514779/how-to-display-current-function-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!