user746461
user746461

Reputation:

How to disable Non-Type proposals in Eclipse?

My auto activation keys are set to a to z. Thus once I type str, it proposes StringBuilder, which is what I want.

Eclipse show Java Type proposals

Then, I press Space to accept the suggestion, and type sb for the variable name. Eclipse shows Non-Type proposals "sBuilder". Since I have decided the variable name to be sb, the Non-Type proposals are useless.

Eclipse show Java Non-Type proposals

As the annoying proposal shows, I cannot continue to type =, because Eclipse will change my variable name from sb to sBuilder. So I have to press Esc, then =.

Every time I define variables, Eclipse always gives me Non-Type proposals, which costs one Esc to reject. How to disable Non-Type proposals in Eclipse??

Upvotes: 4

Views: 3865

Answers (3)

William Jarvis
William Jarvis

Reputation: 357

This question may provide what you want a solution in another form: Stop spacebar keypress from triggering autocomplete in Eclipse

The answers here provides a means for the autocompletion to not interfere with the typing eliminating the problem. I personally have my eclipse set up to trigger autocomplete on every character typed but then have it say (Via source editing) to only have the enter key accept. This allows you for only accepting autocompletion when you want to.

Upvotes: 0

Bananeweizen
Bananeweizen

Reputation: 22070

The easiest way to get what you want is to change your workflow a tiny bit: Type "new Str" instead of "Str" only, let Eclipse auto complete this to "new StringBuilder()", hit Ctrl2,L to automatically create an assignment to a local variable in front of the constructor and just type the name as you want it.

That's less keystrokes and less choices presented by code completion.

Upvotes: 1

Iswanto San
Iswanto San

Reputation: 18569

Try this:

  1. Open Window - Preferences.
  2. Go to Java - Editor - Content Assists - Advanced.
  3. In Advanced page, the Java Proposals should be checked by default. Java Proposals consists of both Non-type and Type proposals.
  4. If you want to disable Non Type Proposal, uncheck the Java Proposals and Java Non-Type Proposals, then check the Java Type Proposals.

Upvotes: 2

Related Questions