Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse autocomplete problems

I use Map a lot in Java with eclipse. e.g.

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

then when I am ready to add something with put:

 String key = null;
 String value = null;
 // somewhere before the put, key and value get populated with Strings
 map.put(key, value);

the problem is, every time I type "map.put", Eclipse autocomplete changes it to "map.compute()" so I have to edit and remove the "com" and the "e".

I looked at Window -> preferences -> Java -> Editor -> Content Assist but nothing was apparent. I could, I suppose, turn off all content assist, but that would be like "throwing the baby out with the bath water". There are a lot of useful things in the content assist.

My Eclipse:

Eclipse IDE for Enterprise Java Developers. Version: 2018-12 (4.10.0) Build id: 20181214-0600 OS: Windows 10, v.10.0, x86_64 / win32 Java version: 1.8.0_144

How can I fix eclipse so it will make the correct suggestions like it did in previous versions?

like image 703
Tony Avatar asked May 03 '19 14:05

Tony


People also ask

Why is Intellisense not working in Eclipse?

The solution is not to tick/untick some stuff under Windows->Preferences->... ->Content Assist-> Advanced. I checked if "ctrl+space" is hijacked by some other thing which is not and checked keyboard language which is English(Those are suggested in mkyong).

How do I trigger an autocomplete in Eclipse?

By default Eclipse triggers the autocompletion after a certain delay when you insert a dot. This is sensible because the dot signals the IDE for example that you got an instance of a class and want to call a method on it. You can bring up the autocompletion by manually pressing Cmd plus Space whenever you want.

How do I turn on autocorrect in Eclipse?

In the Window > Preferences menu, you can search for spell checking (located in General > Editors > Text Editors > Spelling) and there you can edit your spell checking options.

How to fix eclipse autocomplete suggestions (Ctrl-Space) stopped working?

After upgrading Eclipse my Java autocomplete suggestions (Ctrl-Space) stopped working. Here is how to fix it Now make sure the following are all ticked in the top and bottom sections: Apply the changes and then close and re-open your project and it will build the autocompletions which will then become available when you hit Ctrl-Space.

Why was Java autocomplete disabled after upgrade?

A "Java Proposals (Code Recommenders)" was enabled in old workspace which is absent in new version 4.22. Therefore Java autocomplete was disabled after upgrade. Problem solution was to check the entry "Java Proposals" in Content Assist YES. Same applies to upgrade from 4.23 to 4.24.

How to fix autocomplete not working in AutoCAD?

QUICK FIX: Create a new workspace on the new desired location and import the projects from the old workspace. Do not forget to check the “Copy projects into workspace” checkbox so that the projects get copied to the new workspace directory. From this point on autocomplete should be back on its feet.

Is auto-complete broken in the Ui?

The UI doesn't make it easy to search for conflicting bindings... and Auto-Complete is still broken. on the first . if I hit ^space, it DOES find a bunch of "chain template proposals", through getClass () and toString ()...


2 Answers

None of the proposed solutions worked for me. What fixed it was to disable "Show substring matches" (in Preferences -> Java -> Editor -> Content Assist).

It should be considered that this will break the functionality to just type a random part of the desired reference, e.g. typing "PreparedStatement" no longer leads to OraclePreparedStatement. A feature that I don't care about, but this is obviously a matter of personal preference.

In my opinion, the name of that option is a slight misnomer since the substring aspect only applies to leading and not to trailing content.

Update: In Eclipse 2020-06, there is no longer an option "Show substring matches". In its place there is "Show subword matches", but even when disabled, suggestions for typing map.put still include compute. At least when sorted by relevance rather than alphabetically, put is listed in the suggestions before compute.

like image 115
makrom Avatar answered Oct 09 '22 03:10

makrom


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

Unchecking "Java Proposals (Task-Focused)" and instead checking regular "Java Type Proposals" fixed the problem for me. I'm using Eclipse for Enterprise Java Developers 2019-03 on Windows 10.

like image 3
Dan Avatar answered Oct 09 '22 02:10

Dan