Changing the behavior of the Eclipse auto-complete

2020-05-27 12:46发布

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?

3条回答
一纸荒年 Trace。
2楼-- · 2020-05-27 13:16

E-Riz already answered all your other questions but for getting content assist in real-time there is a workaround

Under Preferences > Java > Editor > Content Assist there is an option for "Auto activation triggers for Java". By default it's set to ".". You can append to that all the alphabets (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz) and then it should work.

查看更多
The star\"
3楼-- · 2020-05-27 13:23

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?

Just when the auto-suggestion box pops up, if you hover your mouse pointer to its botton-right corner, you'll be able to see mouse pointer turn into resize pointer. Resize it the way you like and next time when it pops up, it will be of the same size. Hope this helps. :-)

查看更多
地球回转人心会变
4楼-- · 2020-05-27 13:25

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.

查看更多
登录 后发表回答