Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Java auto complete changes exact matches to substring matches

I recently got a new computer, and installed Eclipse 2018-12 (4.10.0)

Since I installed it, auto complete for Java has been showing results in the wrong order. It puts substring matches before exact matches. If, for example, I'm calling the stream() method on a list, I'd type "myList.stream()". The suggestions will show stream() at the bottom of the list, and parallelStream() at the top. Since the default behavior is to replace what you typed with the top result, stream() gets replaced with parallelStream() when I continue typing. The same thing happens on Maps. When I'm trying to use put(), it replaces it with .compute(). On Streams, map() gets replaced with flatMap() as well.

Example of the suggestions for stream()

I've looked all over for a setting to change this, but have yet to even find someone else with this issue. Any help would be appreciated.

If it's useful, I'm on Windows 10.

like image 569
Jacob Richardson Avatar asked Mar 01 '19 20:03

Jacob Richardson


People also ask

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 select a suggestion in Eclipse?

Just got it, go to Window>Preferences>General->Keys and look for "Word completion" as said before. Then near the bottom is "Binding" and to the right of it, a box with an arrow, clicking there you can select "Tab" to use Tabulator for autocomplete.


1 Answers

Well, I feel silly answering my own question minutes after posting it, but I just figured out how to fix it, so here goes.

Load Preferences, then navigate to Java->Editor->Content Assist->Advanced. Check the Java Proposals check box.

I'm not that familiar with the different proposal types in these settings, but turning that one on fixed the problem.

Preferences

like image 168
Jacob Richardson Avatar answered Oct 17 '22 22:10

Jacob Richardson