简体   繁体   English

Eclipse:即时自动完成

[英]Eclipse: Instant autocompletion

I am not entirely comfortable with way how Eclipse autocompletes code. 我对Eclipse自动填充代码的方式并不完全满意。 I like the way how IntelliJ prompts suggestions (some say it's rather aggresive, but I like it that way). 我喜欢IntelliJ如何提示建议的方式(有人说它很有侵略性,但我喜欢这样)。

So I went to: Window -> Preferences -> Java -> Editor -> Content Assist and set delay to 0ms and autoactivation trigger to ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz . 所以我去了:Window - > Preferences - > Java - > Editor - > Content Assist并将延迟设置为0ms,自动激活触发器设置为ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Now Eclipse looks really fast with autocompletion but there's one very annoying thing: It completes proposed names of variables on every space hit . 现在Eclipse在自动完成时看起来非常快,但有一个非常讨厌的事情:它在每个空间命中完成变量的建议名称。

So when I want to type: 所以,当我想输入:

String joe = "Joe";

eclipse is fast enough to ruin it to: 日食快到足以毁掉它:

String joeString = ...;

In other words , pressing: String joe[space] makes joeString. 换句话说,按: String joe[space] joeString. I hope I was clear enoguh, thanks for suggestions :) 我希望我很清楚enoguh,谢谢你的建议:)

You can uncheck 'Window -> Preferences -> Java -> Editor -> Content Assist -> Insert single proposals automatically'. 您可以取消选中“窗口 - >首选项 - > Java - >编辑器 - >内容辅助 - >自动插入单个提议”。 Once done, you should only get a popup window with the proposal but it will not be inserted automatically in the editor. 完成后,您应该只获得一个包含提案的弹出窗口,但不会自动插入编辑器中。

Increase the delay so that you can still type short things without stopping. 增加延迟,这样你仍然可以不停地输入简短的东西。 I'm not sure there is another way to solve it as you are asking Eclipse to always instantaneously autocomplete, and space chooses it's current autocomplete guess. 我不确定还有另一种方法可以解决它,因为您要求Eclipse始终立即自动完成,并且空间选择它当前的自动完成猜测。

There is a solution on the issue tracker for this. 问题跟踪器上有一个解决方案。 Copy the jar in the eclipse/dropins folder. 在eclipse / dropins文件夹中复制jar With the next restart space is diabled as autocompletion trigger. 在下一次重启时,空格将被标记为自动完成触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM