改进 Eclipse 自动完成功能?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5929773/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:16:49  来源:igfitidea点击:

Improving Eclipse autocompletion?

javaeclipseautocompleteintellisense

提问by stefan.at.wpf

Currently the Eclipse autocompletion seems only to be triggered after a dot or on parameters, I want to use it for variables too, e.g. if I have

目前 Eclipse 自动完成似乎只在点或参数后触发,我也想将它用于变量,例如,如果我有

String test="hello";

字符串测试=“你好”;

then I want the autocompletion to suggest "test" if I start typing "t" in the next line (e.g. if I intent to change the value of the variable test).

然后,如果我在下一行开始键入“t”(例如,如果我打算更改变量 test 的值),我希望自动完成建议“test”。

Is there any Eclipse plugin capable of doing this? I already checked the Eclipse content assist options, but seems like there no option for what I want? Thanks for any hint!

是否有任何 Eclipse 插件能够做到这一点?我已经检查了 Eclipse 内容辅助选项,但似乎没有我想要的选项?感谢您的任何提示!

回答by stefan.at.wpf

First of all, thanks for all the replies. They are correct, however you have to press the key combination each time. Here's how it's done automatically:

首先感谢大家的回复。它们是正确的,但是您每次都必须按下组合键。这是自动完成的方式:

That plug-in is not necessary any more. Just go to Preferences > Java > Editor > Content Assist and paste:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.

into the "Auto activation triggers for Java:" field.

不再需要那个插件了。只需转到 Preferences > Java > Editor > Content Assist 并粘贴:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.

进入“Java 的自动激活触发器:”字段。

This simply triggers auto activation after any English alphabet character and after dot. https://bugs.eclipse.org/bugs/show_bug.cgi?id=159157#c12Works fine :-)

这只是在任何英文字母字符和点之后触发自动激活。 https://bugs.eclipse.org/bugs/show_bug.cgi?id=159157#c12工作正常:-)

Hint: You probably want to additionally set the auto activation delay to 0, at least if you are used to visual studio ;-)

提示:您可能还想将自动激活延迟设置为 0,至少如果您习惯了 Visual Studio ;-)

回答by Narayan

In addition to the suggestions above, did you try ALT+ /it does incremental matching? No?

除了上面的建议,你有没有尝试ALT+/它做增量匹配?不?

回答by Matthew Gilliard

ctrl+ space

ctrl+ space

回答by fmucar

If you press ctrl+spacekey combination, eclipse will show you the code assist window.

如果您按下ctrl+space组合键,eclipse 将向您显示代码辅助窗口。

Type t and then hit ctrl+space, it will show you possible matches

输入 t 然后点击ctrl+space,它会显示你可能的匹配

回答by vsvydenko

You can press "t" and then Ctrl+Space.. is it?

您可以按“t”然后按 Ctrl+Space .. 是吗?

回答by Shekhar Khairnar

In Eclipse

在日食中

Window--->Preferences---> search for Content Assist under Content Assist go for Advanced
and check the Java Praposals.

done.

完毕。