Auto code completion on Eclipse

JavaEclipse

Java Problem Overview


I want Eclipse to automatically suggest to me all possible options, while I'm writing some variable/class name or keyword, like in Flash Develop or Visual Studio.

Is it possible?

If not, with which Java IDE can I get this?

I'm specifically asking about a way to automatically get the same thing I get using CTRL + Space, while I'm typing.

Java Solutions


Solution 1 - Java

You can also set auto completion to open automatically while typing.

Go to Preferences > Java > Editor > Content Assist and write .abcdefghijklmnopqrstuvwxyz in the Auto activation triggers for Java field.

See this question for more details.

Solution 2 - Java

Use the Ctrl+Space shortcut for getting all possible autocomplete options available in a particular context in the editor.

Auto Complete will also allow you to insert custom code templates into the editor, with placeholders for various inputs. For instance, attempting to auto complete the word "test" in a Java editor, in the context of a class body, will allow you to create a unit test that uses JUnit; you'll have to code the body of the method though. Some code templates like the former, come out of the box.

Configuration options of interest

  • Auto-activation delay. If the list of auto complete options is taking too long to appear, the delay can be reduced from Windows -> Preferences -> Java -> Editor -> Content Assist -> Auto Activation delay (specify the reduced delay here).
  • Auto activation trigger for Java. Accessible in the same pane, this happens to be the . character by default. When you have just keyed in typeA. and you expect to see relevant members that can be accessed, the auto completion list will automatically popup with the appropriate members, on this trigger.
  • Proposal types. If you do not want to see proposals of a particular variety, you can disable them from Windows -> Preferences -> Java -> Editor -> Content Assist -> Advanced. I typically switch off proposals of most kinds except Java and Template proposals. Hitting Ctrl+Space multiple times will cycle you through proposals of various kinds.
  • Template Proposals. These are different from your run of the mill proposals. You could add your code templates in here; it can be accessed from Windows -> Preferences -> Java -> Editor -> Templates. Configuration of existing templates is allowed and so is addition of new ones. Reserve usage however for the tedious typing tasks that do not have a template yet.

Solution 3 - Java

Go to Windows--> Preference--->Java--->content assist--->Enable auto activation---(insert ._@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in auto activation triggers for java)

Eclipse Preferences

Solution 4 - Java

CTRL+Space

Solution 5 - Java

> Window -> Preferences -> Java -> Editor -> content assist > enter > > > ".abcdefghijklmnopqrstuvwxyz"

in the Auto activation triggers.

It will allow you to complete your code.

Solution 6 - Java

Yes. If the suggestion doesn't compare automatically, then press crtl + space button.

Solution 7 - Java

Its simple, these are the steps:

  1. first go to the following settings Window -> Preferences -> Java -> Editor -> content assist -> advanced
  2. there will be two boxes having checkboxes
  3. check everything in there and click apply
  4. now of course when you'll be coding there will be auto code completion feature automatically

Solution 8 - Java

Since you asked about other Java IDE, I suggest IntelliJ by JetBrains. Just look at it: not only does it support auto completion as you type, but also it support import package once you select the auto completion.

IntelliJ

Before someone said "Eclipse is free", note that IntelliJ has free community edition as well: www.jetbrains.com/idea/download/

Solution 9 - Java

Pressing Ctrl+Space opens up the auto-completion dialog in Eclipse. In the Java Perspective it opens automatically after you typed a . (normally with a short delay).

Solution 10 - Java

See if your settings are correct also:

Window -> Preferences -> Java -> Editor -> content assist. See if the "completion inserts" is checked off along with anything else there you want to help auto complete.

Solution 11 - Java

Now in eclipse Neon this feature is present. No need of any special settings or configuation .On Ctrl+Space the code suggestion is available

Solution 12 - Java

I had a similar issue when I switched from IntellijIDEA to Eclipse. It can be done in the following steps. Go to Window > Preferences > Java > Editor > Content Assist and type ._abcdefghijklmnopqrstuvwxyzS in the Auto activation triggers for Java field

Solution 13 - Java

Steps:

  • In Eclipse, open the code auto completion box from first letter
  • Go to >> Window >> preference >> [ Java c++ php ... ] >> Editor >> Auto activation triggers for...
  • Add the character SPACE by just putting your cursor inside and box and push the space key..

All the commands and variables which begin with that letter are now going to appear

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMarcelo AssisView Question on Stackoverflow
Solution 1 - JavaoshaiView Answer on Stackoverflow
Solution 2 - JavaVineet ReynoldsView Answer on Stackoverflow
Solution 3 - JavaMd.Mainul HasanView Answer on Stackoverflow
Solution 4 - JavaoliholzView Answer on Stackoverflow
Solution 5 - JavaArvina KoriView Answer on Stackoverflow
Solution 6 - JavaHeisenbugView Answer on Stackoverflow
Solution 7 - JavaHarishView Answer on Stackoverflow
Solution 8 - JavaDio PhungView Answer on Stackoverflow
Solution 9 - Javajoe776View Answer on Stackoverflow
Solution 10 - JavaOtraView Answer on Stackoverflow
Solution 11 - Javaharsha kumar ReddyView Answer on Stackoverflow
Solution 12 - JavaSuhas RameshView Answer on Stackoverflow
Solution 13 - Javauser4188298View Answer on Stackoverflow