Eclipse does not give me variable names

It’s good that I saw in Eclipse tips and tricks that you can get the variable name generated by eclipse by pressing Ctrl + Space. However, I get empty offers. Instance Example I type this and press Ctrl + space:

private color

And should I get a few names from him? All I get is an empty list of offers. So what is off? Any idea?

Thanks in advance.

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

+6
source share
8 answers

I believe that you are trying to get the variable name, for example. color after private Color , where color is your class ie private Color color . I see what works in my eclipse.

To check your settings, go to the settings below and make sure they look good.

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

and

  Windows -> Preferences -> Java -> Editor ->Content Assist -> Advanced 
+11
source

Go to window β†’ preferences β†’ java β†’ Editor β†’ content Assist β†’ Advances β†’ Select all checkboxes. DONE :)

+4
source

private ? It looks like you are creating something new .. eclipse cannot offer in this case.

AutoComplete for existing variables / functions / classes, etc.

+2
source

In Eclipse, it can get the name of a variable that you have already done.

For instance,

 int awesomeVariable; awesomeVariable = 50; int superVariable; superVariable = 

If I press Ctrl + Space after this =, it will generate some things that it can fill. For example, it might suggest awesomeVariable. Basically, it does not generate a name for you, it just automatically terminates with the ones you already created.

0
source

Ctrl + Space is probably IM shortcuts, so it’s on, I suggest you change the shortcuts of this function, for example: Alt + /,

If you do not know how to change the shortcuts, see the following steps:

  • press Ctrl + Alt + L twice,
  • find "Content Assist",
  • change the binding value for you, for example, shortcuts (cannot match other shortcuts),
  • Click the "Apply" button.
0
source

Thanks for all the time and help. :)

I finally found it, and the answer to this question was that in my case "java.awt.Color" was not imported, and eclipse does not work on it if it is not imported.

Therefore, it offers you a name if your file already imported the class, but if it did not work, it would not work.

I think this makes the whole function pretty useless, but unfortunately how eclipse works. :/

0
source

it just suggests you also declare a variable by that name .. just helped you because it was a write tool..nothing to worry about it .. you can give your name as you like kk ..

import the Color class into your class: import java.awt.Color;

0
source

This is the default behavior after entering Java type and space, and then press CTRL + Space to activate autocomplete. For example, if you enter:

 private Color 

then activate autocomplete, it will offer you several variable names.

It's easier than pressing CTRL + Space all the time to change the characters that automatically activate autocomplete. It’s very useful for me to have all the characters that could be variable names in order to activate autocomplete. Try ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ as Auto activation triggers for Java found in settings -> Java -> Editor -> Content Assist:

Screenshot of Content Assist Settings

This way you can achieve how Visual Studio handles autocomplete.

0
source

Source: https://habr.com/ru/post/927891/


All Articles