Content Assist in Eclipse Juno is appending the Class name of variables to suggestions. For example, if I start to type:
private String firstName
and hit Return, Eclipse changes this to:
private String firstNameString;
I don't know if this is specific to Juno or if I accidentally turned this 'feature' on, but it is really annoying. Any idea how to get rid of this?
Java > Editor > Content assist > Advanced Uncheck all and hit apply.
Step 1: Open your Eclipse or Spring Tool Suite, then go to the Window > Preferences as shown in the below image. Step 2: In the next screen go to the Java > Editor > Content Assist > Auto activation triggers for Java as shown in the below image.
Using Content AssistThe context assist can be invoked by clicking Ctrl + Space. To select an item from the list just highlight the item using the up or down arrow keys and press enter. If you type some characters and then press Ctrl + space the dialog box will show only items that start with the characters typed in.
I don't know how to resolve the problem when you hit Return
(because i can't reproduce the issue), but here is the solution to tell eclipse to not modify the variable name automatically when you hit ctrl + space
:
In eclipse: Select Window -> Preferences -> Java -> Editor -> Content Assist
uncheck "Insert single prposals automatically".
This problem only seems to occur if you changed the Auto activation triggers for Java
setting to e.g. ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
, which'll make the Content Assist (almost) always pop up, even without pressing Ctrl+Space.
As nitind mentioned, typing a variable name should always end in a comma, semi-colon or space but pressing Enter should be okay. There's a new setting that was added in Eclipse 2018-12 and makes it a bit less annoying (mentioned in the comments below the bug report):
In Window - Preferences - Java - Editor - Content Assist
tick the Disable insertion triggers except 'Enter'
box.
With this setting enabled, Content Assist is still going to trigger (depending on the other settings) but you have to press Enter to accept a suggestion.
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