Eclipse not giving me variable name suggestions

24,841

Solution 1

I believe you are trying to get variable name e.g. color after private Color where Color is you class i.e. private Color color. I see that working in my eclipse.

To verify your settings, go to below settings and verify as they look good to you.

    Windows -> Preferences -> Java -> Editor ->Content Assist

and

    Windows -> Preferences -> Java -> Editor ->Content Assist -> Advanced

Solution 2

This is the default behavior after entering a Java type and a space, and then pressing CTRL+Space to activate auto-complete. For example, if you enter:

private Color 

then activate auto-complete it will suggest some variable names for you.

An easier way than having to press CTRL+Space all the time is to change the characters which automatically activate auto-complete. I find it very useful to have all characters which could possible be variable names to activate auto-complete. Try having ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ as Auto activation triggers for Java found in Preferences -> Java -> Editor -> Content Assist:

Screen shot of the Content Assist settings

This way you can achieve how Visual Studio handles auto-complete.

Solution 3

Goto Window -> preferences -> java -> Editor -> content Assist ->Advances -> Select all the check boxes. DONE :)

Solution 4

I tried them one after the other and found out that the correct one is:

Windows -> Preferences -> Java -> Editor ->Content Assist -> Advanced: check Word Proposals

Solution 5

private? It looks like you're creating something new.. eclipse cannot suggest in this case.

Autocomplete is for existing variables/functions/classes/etc.

Share:
24,841
Arturas M
Author by

Arturas M

I'm a technology enthusiast and a Java Software Engineer

Updated on November 12, 2020

Comments

  • Arturas M
    Arturas M over 3 years

    well I've seen in Tips & Tricks of Eclipse that it's possible to get a variable name generated by eclipse by clicking Ctrl + Space. However I'm getting empty suggestions. Fors instance I'm typing this and click ctrl + space:

    private Color

    And I am supposed to get some name suggestions on it? All I'm getting is an empty list of suggestions. So what's turned off? Any idea?

    Thanks in advance.

    This is what I want to achieve: enter image description here

    • Ionut Hulub
      Ionut Hulub over 11 years
      do it doesn't generate names. it only works after you have created some variables. you type the first letter/letters and when you click ctrl + space you get a list of all the variables that start with that letter/letters. it's an auto-complete tool...
    • Jimmy
      Jimmy over 11 years
      check the settings : Windows > Preferences > Java > Editor > Content Assist > <>
    • xedo
      xedo almost 9 years
      did you find a solution? could you posted it?... the answers don't really solve the problem
  • Arturas M
    Arturas M over 11 years
    Yeah, that's what I'm looking for, however it doesn't seem to work. I tried selecting all of those things in Content Assist, but they don't generate that "color" for me and don't suggest it...
  • Yogendra Singh
    Yogendra Singh over 11 years
    In advanced screen, do you see proposals being listed? If yes, are they selected?
  • DDS
    DDS about 5 years
    Answer looks useful, but in 'C/C++' perspective is impossible to bind with an arbitrary list of characters, is there a way to do it anyway?
  • laurent
    laurent almost 5 years
    Precisely, you want to check the "Java Type Proposals" to achieve what you want.