DEV Community


Posted on

When you get unintended results in Eclipse's code completion that might be the side effect of substring code completion.


  • When you want to complete the method name of a class,sometimes eclipse will complete an unintended method name.
  • I want to explain the measures in such a case.
  • It's probably a side effect of the new feature "Substring code completion" added in Eclipse NEON


  • Eclipse IDE 2019‑06

"Unintended completion" is as follows.Take a look first.

After entering "Arrays", enter a dot(.) To start code completion.
Next, if you enter "tostring" and press the enter key, "deepToString" is selected as a problem.


"Substring code completion" is a useful feature,you know.

Even if only "string" is typed, those that include "string" as part of the method name will be suggested as candidates.


Solution-1: Turn off substring completion

Select Window>Preference>Java>Editor>Content Assist ,then you can find Show substring matches setting image.png.And then turn it off image.png


Try to use "substring completion off"

It feels pretty good.
Unintentional "deepToString" is no longer complemented.


However, if "substring completion" is off, substring completion can not be completed naturally.

I tried typing "string" after "Arrays." and there were no more candidates.



Reopen settings window as before Window>Preference>Java>Editor>Content Assist and turn "substring completion" on image.png

Next, click the [+] "plus" mark on "Content Assist", then expand the settings and select "Advanced".


Check Java Proposals like as follows.


Try code completion

Look at this.

It seems that it moves by the intended action


Try Code Completion with Substring Match

The substring completion is also working properly.


Solution-2 seems to work more as intended.


As for code completion, I think, "Intellij IDEA" (or Android Studio) is much more advanced and corresponds to "substring code completion" and seems to be pre-tuned to have no such side effects.

(I didn't notice it until I encountered it in Eclipse, but the slight differences improved by the tuning of the feeling of use affect productivity and quality, etc.)

Top comments (0)