Eclipse Intellisense?
Asked Answered
I

6

98

How do I tell Eclipse to automatically make suggestions as I type? I'm looking for a Visual Studio Intellisense-like feature with Resharper.

Currently I have to press CTRL+Space each time.

Insulting answered 31/5, 2010 at 11:14 Comment(0)
G
83

You don't have to press CTRL * space but maybe the delay is too big or you don't like the trigger (default is '.'). Go to

Window -> Preferences -> Java/Editor/Content Assist

And change the settings under Auto Activation to your likings.

If this does not work for windows users then see this answer.

Genetics answered 31/5, 2010 at 11:19 Comment(3)
user Kevin Rossi tried to edit to point this (which really is a comment) : "This doesn't work with the Eclipse Juno C/C++ distro"Rauch
Each editor in Eclipse may have its own auto activation triggers--activating on the same characters wouldn't make sense in ever language.Hsu
In Mac it is ADT -> Preferences -> Java/Editor/Content AssistMyrna
H
183

I've get closer to VisualStudio-like behaviour by setting the "Autocomplete Trigger for Java" to

.(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

and setting delay to 0.

Now I'd like to realize how to make it autocomplete method name when I press ( as VS's Intellisense does.

Harter answered 19/11, 2010 at 14:35 Comment(13)
thanks for the tip, thats a little better but still no where near as good as VS!Bolingbroke
Which version of eclipse is this? The "Auto activation triggers for Java" textbox lets me enter only 4 characters.Inequality
This works very well. Much better, since it will actually show local variables and everything now. Thanks! @HappyCoder4U This may not help, but I'm using eclipse 3.7M5.Making
you are genius :) no such setting for non-java languages though :(Benyamin
Awesome. Thank you! Using Eclipse on Mac (3.6.1) the parameter name is 'Auto activation triggers for Java'Marcheshvan
Not sure why the settings aren't like that by default. At 200ms delay, it doesn't even seem to work.Touch
Everything worked but now I get some very irritating behavior: suppose I want to type "private int counter;" I start with private and the autocomplete kicks in with some suggestions (the firt is PrivateCredentialPermission). When I'm done typing private and press "space" PrivateCredentialPermission gets inserted. Any way around this?Jewbaiting
Tony is a pure genius.Nefen
I second on what @VM said. The inclusion of that variable name is rather annoying.Mclyman
@Jewbaiting On the "Code Assist Preferences", on "Insertion", check the "Insert common prefixes automatically".Harrisharrisburg
Great idea! and I help me better understand this eclipse feature.Siberia
See this stack overflow question for some solutions to the space problem: #14298235Palomino
I added space to the list of my list of triggers. This lets me do things like "int x = " and immediately, it shows me a list of method names I can invoke if I so choose.Procarp
G
83

You don't have to press CTRL * space but maybe the delay is too big or you don't like the trigger (default is '.'). Go to

Window -> Preferences -> Java/Editor/Content Assist

And change the settings under Auto Activation to your likings.

If this does not work for windows users then see this answer.

Genetics answered 31/5, 2010 at 11:19 Comment(3)
user Kevin Rossi tried to edit to point this (which really is a comment) : "This doesn't work with the Eclipse Juno C/C++ distro"Rauch
Each editor in Eclipse may have its own auto activation triggers--activating on the same characters wouldn't make sense in ever language.Hsu
In Mac it is ADT -> Preferences -> Java/Editor/Content AssistMyrna
A
46

Tony is a pure genius. However to achieve even better auto-completion try setting the triggers to this:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz =.(!+-*/~,[{@#$%^&

(specifically aranged in order of usage for faster performance :)

Andromeda answered 17/8, 2012 at 15:33 Comment(4)
This method introduces some bugs. For example, if I type in =, it would immediately suggest something. If I press space, = , it would automatically insert the first match.Mclyman
checking Java proposal, Java Type proposal and java non-type proposal and moving them on top in order, worked for me.Firebrick
See this stack overflow question for some solutions to the space problem: #14298235Palomino
All of the special characters will make the Intellisense act screwy except for the period. Basically, if you will ever not want it to Intellisense after a character is typed, you don't want it in this list.Mazurek
E
6

If it's not working even when you already have Code Assist enabled, Eclipse's configuration files are probably corrupt. A solution that worked for me (on Eclipse 3.5.2) was to:

  1. Close Eclipse.
  2. Rename the workspace directory.
  3. Start Eclipse. (This creates a new workspace directory.)
  4. Import (with copy) the Java projects from the old workspace.
Eberly answered 14/7, 2011 at 13:8 Comment(2)
Fixed it for me aswellCram
Nice Solution, it was really helpful to me, my Eclipse was unable to show intellisense after (.) , I had to use ctrl+space 3 times to show it, Thanks for the nice Solution :-)Lavine
H
5

I once had the same problem, and then I searched and found this and it worked for me:

I had got some of the boxes unchecked, so I checked them again, then it worked. Just go to

Windows > Preferences > Java > Editor > Content Assist > Advanced

and check the boxes which you want .

Hathaway answered 23/3, 2014 at 17:50 Comment(1)
Also you can arrange the proposals in order of your priority. If it is to show methods and properties related to your identifier, put Java Proposals (Task Specific) firstAdulation
T
5

d3dave's answer is cool. However theGreenGarbage mentioned an issue about it which I too find rather annoying. So here's one that doesn't immediately suggest something after '=' sign and when typing blank space:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.(!+-*/~,[{@#$%^&

What I did was simply remove the space and '=' chars from the array :)

Alternatively if you want suggestions when typing blank space, but not after '=' sign:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .(!+-*/~,[{@#$%^&
Tautog answered 22/3, 2017 at 18:20 Comment(1)
This should be the accepted answer. Though, it leads to a bit of lagging.Stefanstefanac

© 2022 - 2024 — McMap. All rights reserved.