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

Overview

  • 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

Environment

  • 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 .And then turn it off

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.

Solution-2

Reopen settings window as before Window>Preference>Java>Editor>Content Assist and turn “substring completion” on

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.

Impression

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.)

原文链接:When you get unintended results in Eclipse’s code completion that might be the side effect of substring code completion.

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容