有什么方法可以在 Eclipse 中获得类似 IntelliJ 的自动完成功能?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5685257/
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:10:55  来源:igfitidea点击:

Any way to get IntelliJ-like autocompletion in Eclipse?

javaeclipseintellij-idea

提问by Jarek

I'm stuck with Eclipse in one project and I would like to have autocompletion similar to that of IntelliJ - two major problems are:

我在一个项目中坚持使用 Eclipse,我希望有类似于 IntelliJ 的自动完成功能 - 两个主要问题是:

  • Start typing and Eclipse would automatically suggest all possibilities
  • When there is item selected in dropdown list you can accept it not only with enter key but with dots, spacebars...
  • 开始输入,Eclipse 会自动建议所有可能性
  • 当在下拉列表中选择了项目时,您不仅可以使用 Enter 键接受它,还可以使用点、空格键...

采纳答案by Boro

There is something like that in Eclipse I think, certainly in the Eclipse Helios. When typing you press CTRL+SPACE, or when you typed variable name '.' will start auto-complete options. Also heresomeone suggests to change auto complete delay settings to 0.

我认为在 Eclipse 中有类似的东西,当然在 Eclipse Helios 中。键入时按 CTRL+SPACE,或键入变量名 '.' 将启动自动完成选项。另外这里有人建议将自动完成延迟设置更改为 0。

BTW you can also accept your selection with space bar, for sure.

顺便说一句,您当然也可以用空格键接受您的选择。

EDIT:Why not consider using NetBeans, my personal favourite. There you have an option to show auto-completion on start typing any Java Identifier Part. This would then look exactly as you want it. (in NetBeans Tools->Options->Editor->Code Completion, there in Language box select Java and finally check Auto Popup on Typing Any Java Identifier Part).

编辑:为什么不考虑使用 NetBeans,我个人的最爱。您可以选择在开始键入任何 Java 标识符部分时显示自动完成。这将完全符合您的要求。(在 NetBeans 中Tools->Options->Editor->Code Completion,在 Language 框中选择 Java,最后选中 Auto Popup on Typing Any Java Identifier Part)。

回答by rottweiler

Go to Window → Preferences → Java → Editor → Content Assist. In the column "Auto activation triggers for Java", enter this:

转到窗口 → 首选项 → Java → 编辑器 → 内容辅助。在“Java 的自动激活触发器”列中,输入:

.qwertyuioplkjhgfdsazxcvbnm_QWERTYUIOPLKJHGFDSAZXCVBNM

Add any other keys you want. You're done. That answers your first query. As far as second one goes, I think it already exists.

添加您想要的任何其他键。你完成了。这回答了您的第一个查询。至于第二个,我认为它已经存在了。

回答by Marcel

Take a look at Eclipse Code Recommenders [1] or Codetrails Connect [2]. They make Eclipse' code completion intelligent.

查看 Eclipse Code Recommenders [1] 或 Codetrails Connect [2]。它们使 Eclipse 的代码完成智能化。

[1] http://eclipse.org/recommenders/

[1] http://eclipse.org/recommenders/

[2] http://marketplace.eclipse.org/content/codetrails-connect-community-edition/

[2] http://marketplace.eclipse.org/content/codetrails-connect-community-edition/

回答by zhijuexu

Since Eclipse Juno, Code Recommenders Intelligent Java Proposals replaced the old JDT's Java Proposals.

自 Eclipse Juno 以来,Code Recommenders Intelligent Java Proposals 取代了旧的 JDT 的 Java Proposals。

It afford "Intelligent Code Completion" function, like IntelliJ did in a way.

它提供了“智能代码完成”功能,就像 IntelliJ 所做的那样。

You can get something useful through the link below:

您可以通过以下链接获得一些有用的信息:

http://code-recommenders.blogspot.jp/2012/07/code-recommenders-10-code-completion-on.html

http://code-recommenders.blogspot.jp/2012/07/code-recommenders-10-code-completion-on.html

回答by sandalone

I have to say NO. I moved from Eclipse to IntelliJ because of the intellisense and inability to make Eclipse behave like IntelliJ (or if you come from the .NET environment: inability to make Eclipse intellisense behave like ReSharper in .NET).

我不得不说不。我从 Eclipse 转移到 IntelliJ,因为智能感知和无法使 Eclipse 表现得像 IntelliJ(或者如果您来自 .NET 环境:无法使 Eclipse 智能感知表现得像 .NET 中的 ReSharper)。

Do you HAVE TO work in Eclipse? I do 98% of work in IntelliJ, then convert the project into Eclipse project (IntelliJ can still access it) and finish it in Eclipse. Maybe you could try this solution.

你必须在 Eclipse 中工作吗?我 98% 的工作都是在 IntelliJ 中完成的,然后将项目转换为 Eclipse 项目(IntelliJ 仍然可以访问它)并在 Eclipse 中完成它。也许你可以试试这个解决方案。