Reputation: 135
Okay, so my issue is when I am creating a variable, lets say for example "Object o" while I am typing "o" it'll suggest something like "object". Which is okay but when I press space it auto fills in the new name. Basically I don't want to turn off auto completion I just want to disable space auto filling the suggestion in. Even to disable variable naming suggestions would work.
I'm using Eclipse Juno Service Release 1.
Upvotes: 12
Views: 13176
Reputation: 1734
This is an old question. But, as it doesn't have the solution that actually worked for me, I'm going to put it in here.
You have 2 solutions:
As @Alien said here, you can enable Disable insertion triggers except 'Enter'
option to stop eclipse to automatically inserting it. This was my temporary solution.
The answers that suggests disabling certain proposals are onto something. So, I've been tinkering around with those proposals, and strangely, It worked for me. I think this is what @gazzman was trying tell through his answer I guess.
Go to: Windows > Preferences > Java > Editor > Content Assist > Advanced, and under Default Proposal Kinds, Disable Java Non-Type Proposals
, Java Proposals
, Java Proposals (Task-Focused)
, and only enable Java Type Proposals
.
With this, I'm getting no suggestions for variables with their type as suffix. Many people who've answered with this weren't clear at all.
What I've seen in my IDE, Java Non-Type Proposals
, Java Proposals
and Java Proposals (Task-Focused)
are the proposals that are responsible for it.
In this code, once after I press <tab>
right here...
String hi<tab>
Case 1: If you only enable Java Non-Type Proposals
, You'll get hiString
as a suggestion. (Enabling Java Type Proposals
has no change in the output. It'll be the same even if disabled).
It appears like this:
Case 2: If you enable either/both Java Proposals
and Java Proposals (Task-Focused)
, You'll get hiString
as a suggestion (yeah, the same thing).
(All these combinations yield only one suggestion, i.e., hiString
)
Here, it appears like this:
Case 3: If you enable Java Non-Type Proposals
, Java Proposals
and Java Proposals (Task-Focused)
altogether, You'll get hiString
twice as suggestions.
And it appears like this:
But after only enabling Java Type Proposals
, I don't get any of those suggestions in Default suggestions.
My IDE, on which I've tried it: Eclipse v2024-03 (4.31.0)
Upvotes: 1
Reputation: 161
I know it's an old question but since non of the answers here worked for me, and this problem was really annoying me too, I am adding solution that helped me.
In your Eclipse go to: Window/Preferences/Java/Editor/Content Assist
and enable:
Disable insertion triggers except 'Enter'
Hopefully that will work for everyone!)
Upvotes: 16
Reputation: 616
I realize this is a 3 year old post, but...
From what I can gather, there isn't an option to disable this, it was hard coded into the content assist feature. But there is a plugin that you can download from the answer to this stack overflow question that will disable this feature
Upvotes: 1
Reputation: 1
Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced I turned off Java Type Proposals and made sure Java Proposals is turned on. By the way this is in Spring Tool Suite I haven't checked using eclipse.
Upvotes: 0
Reputation: 41123
As there isn't any definitive solution for this yet, what I find works best is to disable the alphabetic characters from triggers:
Windows > Prefereces > Java > Editor > Content Assist > Auto activation triggers for Java
This will mean no class name / type completion, but method name completion will still be suggested when you pressed dot, however at least Eclipse stop messing with my variable name
Upvotes: 3
Reputation: 1278
Go to Window/Preferences/Java/Editor/Content Assist
and choose settings that works for you.
Upvotes: 1