45

I'm stuck with Eclipse in one project and I would like to have autocompletion similar to that of IntelliJ - two major problems are:

  • Start typing and Eclipse would automatically suggest all possibilities
  • When there is item selected in dropdown list you can accept it not only with enter key but with dots, spacebars...
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Jarek
  • 7,425
  • 15
  • 62
  • 89
  • 2
    why not ask a question about how to coexist with IDEA and Eclipse on the same project (if that's the reason you're stuck with eclipse)? – Denis Tulskiy Apr 16 '11 at 09:59
  • is it possible to work on the same project on a disk in IDEA and then ECLIPSE ? will there be any corruption or risk of loss of data – KJW Nov 23 '11 at 06:36
  • 1
    This post solved your problem http://stackoverflow.com/questions/1991208/type-ahead-autocompletion-in-eclipse –  Jan 28 '12 at 03:51
  • 1
    http://stackoverflow.com/questions/1991208/type-ahead-autocompletion-in-eclipse here solved your problem. –  Jan 28 '12 at 03:53

5 Answers5

106

Go to Window → Preferences → Java → Editor → Content Assist. In the column "Auto activation triggers for Java", enter this:

.qwertyuioplkjhgfdsazxcvbnm_QWERTYUIOPLKJHGFDSAZXCVBNM

Add any other keys you want. You're done. That answers your first query. As far as second one goes, I think it already exists.

rottweiler
  • 1,201
  • 1
  • 12
  • 23
  • 10
    One of the best tweek for Eclipse. Thanks! – A1exandr Belan Mar 10 '13 at 19:07
  • 2
    I was planning to port to IntelliJ fbut after this tweek I don't think I need to do that. :) – alienCoder May 09 '14 at 02:33
  • Also make sure to remove code recommenders java proposals from Window → Preferences → Java -> Editor → Content Assist → Advanced. It speeds it up a lot. Switch it to just java proposals. – Ajay Dec 10 '16 at 04:37
  • 3
    why is it not enabled by default? – eastwater Oct 26 '17 at 15:48
  • 3
    Bye bye `CTRL-SPACE` – A.W. Aug 03 '18 at 14:07
  • 1
    +1000, Eclipse can do so many things, it's a shame that a lot of them don't get used because they are hard to spot. There should really be a tooltip on the input fields, it doesn't help that the info of what an option does are retrievable from the help, there should just not be the need to search for them in the first place, the options I'm looking at are right there in that dialog and if I just need to hover on them to know what they do and decide about using them or not, I will do that, and if I have to start looking for that in help pages I won't, just like the vast majority of people. – SantiBailors May 30 '20 at 11:26
3

Take a look at Eclipse Code Recommenders [1] or Codetrails Connect [2]. They make Eclipse' code completion intelligent.

[1] http://eclipse.org/recommenders/

[2] http://marketplace.eclipse.org/content/codetrails-connect-community-edition/

Marcel
  • 187
  • 7
2

Since Eclipse Juno, Code Recommenders Intelligent Java Proposals replaced the old JDT's Java Proposals.

It afford "Intelligent Code Completion" function, like IntelliJ did in a way.

You can get something useful through the link below:

http://code-recommenders.blogspot.jp/2012/07/code-recommenders-10-code-completion-on.html

Paco Abato
  • 3,920
  • 4
  • 31
  • 54
zhijuexu
  • 199
  • 1
  • 5
2

I have to say NO. I moved from Eclipse to IntelliJ because of the intellisense and inability to make Eclipse behave like IntelliJ (or if you come from the .NET environment: inability to make Eclipse intellisense behave like ReSharper in .NET).

Do you HAVE TO work in Eclipse? I do 98% of work in IntelliJ, then convert the project into Eclipse project (IntelliJ can still access it) and finish it in Eclipse. Maybe you could try this solution.

sandalone
  • 41,141
  • 63
  • 222
  • 338
  • 4
    -1 This gives the wrong answer to the question, incorrectly assumes that resharper is the reason for the Visual Studio intellisense AND tries to push the OP into buying a product that the OP doesn't necessarily need. – stepanian Aug 03 '14 at 09:16
  • @stepanian There is no buying. It's free to use. ;) – sandalone Aug 04 '14 at 05:19
  • You need the Ultimate Edition to do anything useful like Servlets, SQL, etc. – stepanian Aug 04 '14 at 06:14
  • I have been using it for Android development only and I don't need anything to buy ;) – sandalone Aug 04 '14 at 06:27
1

There is something like that in Eclipse I think, certainly in the Eclipse Helios. When typing you press CTRL+SPACE, or when you typed variable name '.' will start auto-complete options. Also here someone suggests to change auto complete delay settings to 0.

BTW you can also accept your selection with space bar, for sure.

EDIT: Why not consider using NetBeans, my personal favourite. There you have an option to show auto-completion on start typing any Java Identifier Part. This would then look exactly as you want it. (in NetBeans Tools->Options->Editor->Code Completion, there in Language box select Java and finally check Auto Popup on Typing Any Java Identifier Part).

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Boro
  • 7,913
  • 4
  • 43
  • 85
  • 22
    If you've ever worked in both apps, then you'd realize you cannot compare Eclipse's autocomplete with IntelliJ's autocomplete ;) – sandalone Apr 17 '11 at 14:14
  • @askmo Yea I have not much experience with IntelliJ. But from the problem description it seems that you have all this features in NetBeans, though in Eclipse I see no way of doing it. – Boro Apr 17 '11 at 16:13
  • I still think that IntelliJ has the best autocomplete (intellisense) tool. It does have other bad things, but with regard to autocomplete, I find it the best. Nevertheless I do agree that NetBeans is better than Eclipse, however Eclipse is prefered tool for Android development. – sandalone Apr 20 '11 at 09:12
  • Yea I do agree with your argument. Maybe one day I will try IntelliJ once more. Best Regards – Boro Apr 20 '11 at 18:28