21

Currently the Eclipse autocompletion seems only to be triggered after a dot or on parameters, I want to use it for variables too, e.g. if I have

String test="hello";

then I want the autocompletion to suggest "test" if I start typing "t" in the next line (e.g. if I intent to change the value of the variable test).

Is there any Eclipse plugin capable of doing this? I already checked the Eclipse content assist options, but seems like there no option for what I want? Thanks for any hint!

stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270

6 Answers6

58

First of all, thanks for all the replies. They are correct, however you have to press the key combination each time. Here's how it's done automatically:

That plug-in is not necessary any more. Just go to Preferences > Java > Editor > Content Assist and paste:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.

into the "Auto activation triggers for Java:" field.

This simply triggers auto activation after any English alphabet character and after dot. https://bugs.eclipse.org/bugs/show_bug.cgi?id=159157#c12 Works fine :-)

Hint: You probably want to additionally set the auto activation delay to 0, at least if you are used to visual studio ;-)

Mohamed El-Nakeep
  • 6,580
  • 4
  • 35
  • 39
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
  • And you probably want to add there also space character, because then it completes after every space :) – Xorty Jul 14 '11 at 18:55
  • This is the answer you probably want if you found this question (it's the one I wanted at least!) – MrPurpleStreak Aug 03 '11 at 20:50
  • 1
    It appears that in the latest version of eclipse (I'm actually using easyEclipse, which is eclipse + addons, version 1.3.1.1). You can only enter 4 characters in that field. So at most you can ask it to trigger for 'ABCD'. – Simon Verbeke Sep 21 '12 at 21:00
3

In addition to the suggestions above, did you try ALT + / it does incremental matching? No?

Narayan
  • 6,031
  • 3
  • 41
  • 45
  • it does something when I pressed strg+space, yet I don't really understand what it does? – stefan.at.kotlin May 08 '11 at 20:11
  • this is a cool feature; didn't know about it so far. I bound it to "Alt + ." to be more consistent with "Ctrl + ." for "Next". Is there an equivalent to "Previous" ("Ctrl + ,") also in this context, i.e. jump back to the previous word completion? – derwiwie May 16 '18 at 07:46
1

In Eclipse

Window--->Preferences---> search for Content Assist under Content Assist go for Advanced
and check the Java Praposals.

done.

Shekhar Khairnar
  • 2,643
  • 3
  • 26
  • 44
1

ctrl + space

Matthew Gilliard
  • 9,298
  • 3
  • 33
  • 48
1

If you press ctrl+space key combination, eclipse will show you the code assist window.

Type t and then hit ctrl+space, it will show you possible matches

fmucar
  • 14,361
  • 2
  • 45
  • 50
1

You can press "t" and then Ctrl+Space.. is it?

vsvydenko
  • 729
  • 1
  • 9
  • 22