eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
156 stars 123 forks source link

[content assist] Autocomplete for collections does not use diamond operator #2751

Closed jubax closed 1 month ago

jubax commented 1 month ago

Recently I noticed that most of the time autocompleting

HashMap<String, String> map = new Hash

will lead to

HashMap<String, String> map = new HashMap<String, String>()

instead of

HashMap<String, String> map = new HashMap<>()

I think (but I'm not sure) this has worked reliably at some point in the past. A team member who also noticed this behavior said that it already was this way before 2024-06.

Is there some workaround or some setting to improve the situation?

stephan-herrmann commented 1 month ago

Please have a look at the preferences at Java > Editor > Content Assist > Advanced.

If you see anything with "Task focused" in the name, that's not the original from JDT. Try disabling it in favor of the standard proposal kind.

jubax commented 1 month ago

Please have a look at the preferences at Java > Editor > Content Assist > Advanced.

If you see anything with "Task focused" in the name, that's not the original from JDT. Try disabling it in favor of the standard proposal kind.

Oh, wow. That was indeed the case and I just reset to default and everything works fine again. Thank you very much!

I cannot remember activating this, but maybe I accidentally activated this while I was trying to improve the content assist (https://github.com/eclipse-jdt/eclipse.jdt.core/issues/961).

Thanks again!

stephan-herrmann commented 1 month ago

Thanks, @jubax for confirming.

Closing as not a JDT bug.