This article is part of a ‘mini series’ about hidden gems, tips and tricks around Eclipse.
The topic of this one is how to show where a variable, function, … is declared or defined.
Eclipse is building up in the background a large data base about things in the editor. This database is called ‘the Index‘. One way to use it is to use the context menu (or F3) on any item in the source editor:
This not only jumps to the declaration: if done twice it jumps between declaration and definition.
There is a menu item for this too:
Another way is to use mouse left button with the <CTRL> key pressed: this underlines the items in the editor and does the same as clicking on link in your web browser:
That works for pretty much everything, including #include in the source editor:
Similar to a web browser, there is a ‘back’ and ‘forward’ too:
What I use most of the time are the keyboard shortcuts:
- F3: Jump
- Alt+Left: Back
- Alt+Right: Forward
Happy browsing 🙂
Links
- Eclipse Gems, Tips & Tricks: Importing Projects
- Eclipse Gems, Tips & Tricks: Close and Open Projects
- Eclipse Gems, Tips & Tricks: Text Block Selection
- Eclipse Gems, Tips & Tricks: Project Filter
- Eclipse Gems, Tips & Tricks: Black Theme
- Eclipse Gems, Tips & Tricks: Faster Debugger Start
- Eclipse Gems, Tips & Tricks: RT(F)M
- Eclipse Gems, Tips &Tricks: Show in System Explorer
- Eclipse Gems, Tips & Tricks: Open Declaration
- Eclipse Gems, Tips & Tricks: Code Completion
- Eclipse Gems, Tips & Tricks: Highlight Usage and Definition
- Eclipse Gems, Tips & Tricks: Block Comments
- Eclipse Gems, Tips & Tricks: Working Sets
These features are invaluable, and get used hundreds of times daily. They improve productivity so much.
I’ve done some work on MPLabX recently and it is flaming horrible in this regard. Just awful. Eclipse has spoiled me in a good way 🙂
Erich, here’s one for you: call hierarchy works on some projects, but not others. It’s like the scope is wrong, but I can’t find where to change it. Do you know where to find such a thing? I’m using Window Working Sets for everything else.
LikeLike
Hi Rhys,
if the call hierarchy is wrong, then most likely it is because of the indexer: have you re-build the index and disabled heuristics already? This is especially useful if using more complex projects. See https://mcuoneclipse.com/2012/03/20/fixing-the-eclipse-index/
LikeLike
Thanks Erich. In this case I don’t think that’s it; all indexer things checked and refreshed etc, as per your posts. It turns out that in my search scope for Call Hierarchy I seem to have to check the first project that uses that file (or, just all of them). Looks like a bug to me. Now at least I have something I can work with.
LikeLike
Pingback: Eclipse Gems, Tips & Tricks: Working Sets | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Block Comments | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Highlight Usage and Definition | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Code Completion | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Faster Debugger Start | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Project Filter | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Text Block Selection | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Close and Open Projects | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Importing Projects | MCU on Eclipse
Pingback: Eclipse Gems, Tips & Tricks: Code Folding | MCU on Eclipse
Pingback: FreeRTOS and Eclipse Indexer for >5K Lines Source Files | MCU on Eclipse
Pingback: Eclipse Indexer Debug Tips | MCU on Eclipse