I seem to frequently trip over a particular "feature" of Eclipse's autocomplete behavior. Say that I'm programming in Java and start to code a method call like this:
for (int i = 0; i < n; ++i) { thing.
When I type the .
, Eclipse pops up a list of candidate methods for thing
. Suppose I select method(int index)
. Eclipse inserts my choice:
for (int i = 0; i < n; ++i) { thing.method(index)
It also highlights index
and pops up a list of variables I might want to use. The first item on the list is index
and the second one is i
. Not wanting to move my hands from the keyboard, I type i
.
The problem is, I then out of habit usually press enter
to complete the autocompletion sequence. Unfortunately, this causes Eclipse to select the first item on the suggestion list that starts with i
, which is index
. Argh! To avoid this, I need to either:
tab
instead of enter
after typing i
;i
from the suggestion list instead of typing it;esc
(twice!) to get rid of the suggestion list before pressing enter
.With all of these, I'm forced to interrupt my thinking about my code in order to think about how to use Eclipse.
I realize that this is a long-winded rant for a fairly niggling problem, but I do actually have a question. Are there any settings in Eclipse (short of turning off autocompletion, which is otherwise very helpful) to either (1) tell it to rank legal options above illegal ones in the suggestion list or (2) otherwise tell Eclipse that when I type an i
, that's what I want?
Microsoft Visual Studio has a famous feature called IntelliSense. Eclipse has a similar built in feature called "Code Assist" which I find very useful. Code Assist is triggered automatically in a number of situations (for example, typing the "." after a variable name or class name).
In the 'Java -> Editor -> Content Assist' preference page set 'Fill method arguments and show guessed arguments' to 'Insert best guessed arguments'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With