0

In my javaIDE eclipse indigo, started making a list e.g.

List<Integer> list = new 

and then hit Ctrl + space and the top choice was ArrayList() which then filled in the rest

List<Integer> list = new ArrayList<Integer>();

Now I have moved to Spring Tools Suite, and this ArrayList is not even found in the list, let alone at the top until I type "ar".

Is there a way of making this ArrayList() show in the autocomplete list and if so, how so I can do it with other implementing classes as well (e.g. Map -> HashMap, etc.).

P.S. I have seen other posts like this and I don't want suggestions to do it another way e.g. Ctrl+2, L. This is because I type this way

Thanks

user3206236
  • 315
  • 5
  • 14
  • Did you have any additional plug-ins (like Code Recommenders) in the Indigo installation? Which version is your STS based on? – nitind Jul 02 '14 at 12:28
  • version 3.3.0.RELEASE, I have no idea about the plug-ins – user3206236 Jul 02 '14 at 14:19
  • The version of STS is not useful in this regard. – nitind Jul 02 '14 at 15:21
  • We are all guessing here... but nitind's suggestion seems worth more attention. These kinds of suggestions is exactly what 'code recommenders' do. So I suggest you compare the content-assist configuration between your STS and plain Eclipse. You can probably install code recommenders into STS if you like their content assist. – Kris Jul 03 '14 at 16:28

3 Answers3

1

You can change the settings of content assist in Window->Preferences->Java->Editor->Code Assist.

Perhaps STS added something that is being looked at before Java API.

Have you tried hitting CTRL+Space multiple times?

Instantsoup
  • 14,825
  • 5
  • 34
  • 41
0

If ArrayList is not in the list it might be a problem introduced by Groovy Eclipse if it's installed... I can't reproduce your issue with plain STS though. ArrayList constructor proposals show up for me at the top only if I type "ArrayL" for both STS and plain Eclipse. BTW CTrl + Space pressed multiple times should help if the problem is coming from Groovy-Eclipse.

aboyko
  • 1,337
  • 1
  • 9
  • 11
0

It's unlikely that plain Eclipse Indigo could do that kind of completion.

To get something that's close to what you want to have (i.e., recommending all subtypes of List), look at [1]. There's also a crowdsourcing approach that does something similar. Read [2] for details.

To see an example of both content assists in action, look at the screenshot in [3].

[1] http://www.codetrails.com/blog/use-subtype-aware-completion-and-help-shape-future-code-completion,

[2] http://www.codetrails.com/blog/powered-33-million-code-completions-codetrails-connect-12

[3] https://twitter.com/MarcelBruch/status/486392482138427392

Marcel
  • 187
  • 7