6

Coming from Visual Studio and starting a project in Java, I realized I couldn't cope with having to press ctrl+space to have the autocomplete panel show up. An easy workaround was to set all keyboard characters to be trigger characters for autocompletion.

My only problem is that, when presented with autocomplete suggestions, a single press on the space bar will write the first proposition. In situations where I'm happy with the suggestions, that's just fine. In situations where I actually want to use what I wrote down initially, I have to press 'escape' first to remove the autocomplete panel before I can press 'space' safely.

Netbeans doesn't use the space bar as a validating key for autocompletion (only 'enter' does that) and I like that behavior. Any way to replicate it in Eclipse?

Thanks in advance for your answers!

EDIT: I should have mentioned I'm using Eclipse on the Mac.

Guillaume

guidupuy
  • 505
  • 3
  • 15
  • Possible duplicate of [Stop spacebar keypress from triggering autocomplete in Eclipse](https://stackoverflow.com/questions/14297735/stop-spacebar-keypress-from-triggering-autocomplete-in-eclipse) – Pyves Dec 20 '18 at 21:56

2 Answers2

2

I have the same problem with Eclipse Indigo on Windows XP actually. Coming from intellij idea, I also felt the need to set the whole keyboard to trigger auto-complete.

A quick proof that SPACE key does accept suggestions : type inte on a new line. If the auto-complete menu shows, press SPACE. It goes for Integer.

If anyone knows how to set the SPACE key to "ignore suggestions", it would be great, because the escape key on my keyboard is also too far away :)

Thanks

Edit : actually the best would be to have only the ENTER key validating, because ';' and '(' also seem to validate

Arnaud P
  • 12,022
  • 7
  • 56
  • 67
0

I just tried to reproduce your behavior, but couldn't. Here is the configuration I have (and the steps I have done to reproduce):

  • I have installed Indigo (current version of Eclipse, version number 3.7).
  • I did not change any configuration there, this is what is the default:
  • Under Window > Preferences > Java > Editor > Content Assist, I have the following settings:
    • Completion inserts (instead of overwrite)
    • Insert single proposal automatically (which is ok most of the time)
    • not insert common prefix automatically

I have a simple class, go down to a method, and do the following steps:

  1. Enter this.no and wait some time. Sometimes I have to press CTRL + SPACE, sometimes not.
  2. Proposal pops up which includes notify and notifyAll.
  3. I press SPACE and a space is inserted in the text, the autocomplete suggestions are closed without inserting anything.

I do not know if older versions of eclipse have the same behavior.

mliebelt
  • 15,345
  • 7
  • 55
  • 92
  • Did you try on a Mac, Windows or Linux installation of Eclipse? I should have mentioned that I'm having this problem with Eclipse running on Mac Os X Lion – guidupuy Sep 10 '11 at 18:28
  • I tried to do the same as @mliebelt, and my result was the same with Eclipse 3.7 and OS X Lion. – Zoltán Ujhelyi Sep 10 '11 at 20:36