Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse autocomplete irritation

Tags:

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:

  1. remember to press tab instead of enter after typing i;
  2. select i from the suggestion list instead of typing it;
  3. press 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?

like image 262
Ted Hopp Avatar asked May 26 '11 21:05

Ted Hopp


People also ask

What is IntelliSense in eclipse?

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).


1 Answers

In the 'Java -> Editor -> Content Assist' preference page set 'Fill method arguments and show guessed arguments' to 'Insert best guessed arguments'

Preference page

like image 198
Robert Munteanu Avatar answered Oct 22 '22 12:10

Robert Munteanu