Changing the behavior of the Eclipse auto-complete (Content Assist)

amiregelz picture amiregelz · Jul 21, 2012 · Viewed 16.4k times · Source

When I am programming in Eclipse, the auto-complete \ suggestions box usually opens when typing a dot (for example after typing System. or SomeObject., and stays open while typing a similar code to any of the suggested.

This is what I'm talking about: enter image description here

I often use the auto-complete \ suggestions box to my advantage, and there are couple of changes I would like to make in order to improve my productivity while programming, if possible;


  • Is there any way to make the suggestions box visible all the time, showing suggestions in real-time (and showing a blank box when there are no available suggestions) ?

  • Is there any way to add permanent custom suggestions to the suggestions box (e.g. a switch case template or a line of code like public String toString()) ?

  • Is there any way to re-order the suggestions box (e.g. class private variables before general functions or System.out.println() before System.out.print()) ?

  • Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?

Answer

E-Riz picture E-Riz · Jul 21, 2012

FYI, in Eclipse terminology this feature is called Content Assist.

Is there any way to make the suggestions box visible all the time, showing suggestions in real-time (and showing a blank box when there are no available suggestions) ?

No, that's not possible. You can invoke it any time you want via Ctrl+Space (Command+Space on Mac)

Is there any way to add permanent custom suggestions to the suggestions box (e.g. a switch case template or a line of code like public String toString()) ?

Yes, you can add your own templates via Preferences > Java > Editor > Templates

Is there any way to re-order the suggestions box (e.g. class private variables before general functions or System.out.println() before System.out.print()) ?

Not really. There is some control of the order for "cycling" through proposal types via Preferences > Java > Content Assist > Advanced, but it's not really what you're looking for. The order of proposals is, I think, based on the current context of when Content Assist is invoked.

Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?

All of the customization option are available under Preferences > Java > Content Assist; color options are available under Preferences > General > Appearance > Color and Fonts, but I think the colors for that pop-up might come from your operating system color settings.

If you're using (or willing to use) Eclipse Juno (4.2) then there is a new project call Code Recommenders that you might find interesting.