This article is part of a ‘mini series’ about hidden gems, tips and tricks around Eclipse.
The topic of this one is how use Code Completion in the editor.
One of the most powerful helpers of an IDE is Code Completion: the automatic completion of what I start writing in code.
In Eclipse this feature is accessible with <CTRL>+<SPACE> while writing in the Editor View. It works pretty much everything:
Type
#inc
and then press <CTRL>+<SPACE> and it completes it to
#include
Add the double quotes and hit again <CTRL>+<SPACE> and it gives you a list of possible choices:
Continue typing and it narrows down the list to the remaining choices:
Use the cursor up/down to select an item in the list and hit enter to use it:
Start typing a library function call and it shows you the prototype including a help text:
Inside a function call, <CTRL>+<SHIFT>+<SPACE> will show the parameter names:
The same without the <SHIFT> automatically fills in the names:
Start typing a language keyword and it helps you on that too:
Enter ‘switch’ and it will fill out a template for you:
Same thing for variables of any kind: start typing and it shows the struct members:
It is really that easy: start with something and hit <CTRL>+<SPACE> and you get suggestions what can be added.
Happy completing 🙂
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
Very useful – thank you. I didn’t know that was in Eclipse.
I will definitely take advantage of it.
myke
LikeLiked by 1 person
Hi myke,
great! This confirms that such tips can be useful. Code Completion is one of the very useful features of most IDE, and definitely for me the most used one in Eclipse.
LikeLike
Short and sweet, I like this series! Keep up the good work!
LikeLiked by 1 person
Thank you, will keep this going (as time permits) 🙂
LikeLike
I use custom templates for tagging changes in code, because there can be a lot of them. The content might be something like:
// [RD] V1.23 ${cursor}
in the C/C++ context, and
[RD] V1.23 ${cursor}
in the comment context. I call them ‘tag’, so it’s “tag+”. tSaves me a bucket of time.
Hope it helps someone.
One thing I’d like to do is make the “V1.23” a custom parameter (so I only have to edit it once), but I haven’t figured that one out yet.
LikeLiked by 1 person
To my understanding (and after some trials) only the built-in template variables can be used. Did not see a way to add a custom parameter.
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: 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