Eclipse 智能感知?

发布于 2024-09-04 07:25:36 字数 135 浏览 10 评论 0原文

如何让 Eclipse 在我键入时自动提出建议?我正在寻找 Resharper 的类似 Visual Studio Intellisense 的功能。

目前我每次都必须按 CTRL+Space

How do I tell Eclipse to automatically make suggestions as I type? I'm looking for a Visual Studio Intellisense-like feature with Resharper.

Currently I have to press CTRL+Space each time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

昔日梦未散 2024-09-11 07:25:36

通过将“Java 自动完成触发器”设置为

.(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

并将延迟设置为 0,

我已经更接近 VisualStudio 的行为。现在我想了解如何在按下时使其自动完成方法名称(就像 VS 的 Intellisense 那样)。

I've get closer to VisualStudio-like behaviour by setting the "Autocomplete Trigger for Java" to

.(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

and setting delay to 0.

Now I'd like to realize how to make it autocomplete method name when I press ( as VS's Intellisense does.

故事↓在人 2024-09-11 07:25:36

您不必按 CTRL * 空格,但可能延迟太大或者您不喜欢触发器(默认为“.”)。前往

窗口->首选项->
Java/编辑器/内容辅助

并根据您的喜好更改自动激活下的设置。

如果这对 Windows 用户不起作用,请参阅此答案

You don't have to press CTRL * space but maybe the delay is too big or you don't like the trigger (default is '.'). Go to

Window -> Preferences ->
Java/Editor/Content Assist

And change the settings under Auto Activation to your likings.

If this does not work for windows users then see this answer.

岁月打碎记忆 2024-09-11 07:25:36

托尼是一个纯粹的天才。然而,为了实现更好的自动完成,请尝试将触发器设置为:(

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz =.(!+-*/~,[{@#$%^&

特别按使用顺序排列以获得更快的性能:)

Tony is a pure genius. However to achieve even better auto-completion try setting the triggers to this:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz =.(!+-*/~,[{@#$%^&

(specifically aranged in order of usage for faster performance :)

羁客 2024-09-11 07:25:36

如果即使您已经启用了 Code Assist,它仍然无法工作,则 Eclipse 的配置文件可能已损坏。对我有用的解决方案(在 Eclipse 3.5.2 上)是:

  1. 关闭 Eclipse。
  2. 重命名工作区目录。
  3. 启动 Eclipse。 (这将创建一个新的工作区目录。)
  4. 从旧工作区导入(带副本)Java 项目。

If it's not working even when you already have Code Assist enabled, Eclipse's configuration files are probably corrupt. A solution that worked for me (on Eclipse 3.5.2) was to:

  1. Close Eclipse.
  2. Rename the workspace directory.
  3. Start Eclipse. (This creates a new workspace directory.)
  4. Import (with copy) the Java projects from the old workspace.
混浊又暗下来 2024-09-11 07:25:36

d3dave 的回答很酷。然而 theGreenGarbage 提到了一个关于它的问题,我也觉得这很烦人。因此,这里有一个在“=”符号之后和输入空格时不会立即提出建议的方法:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.(!+-*/~,[{@#$%^&

我所做的只是从数组中删除空格和“=”字符:)

或者,如果您在输入空格时需要建议,但是不在“=”符号之后:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .(!+-*/~,[{@#$%^&

d3dave's answer is cool. However theGreenGarbage mentioned an issue about it which I too find rather annoying. So here's one that doesn't immediately suggest something after '=' sign and when typing blank space:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.(!+-*/~,[{@#$%^&

What I did was simply remove the space and '=' chars from the array :)

Alternatively if you want suggestions when typing blank space, but not after '=' sign:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .(!+-*/~,[{@#$%^&
舂唻埖巳落 2024-09-11 07:25:36

我曾经遇到过同样的问题,然后我搜索并找到了这个,它对我有用:

我没有选中一些框,所以我再次检查它们,然后它就工作了。只要去

Windows >首选项>爪哇>编辑>内容辅助>高级

并选中您想要的框。

I once had the same problem, and then I searched and found this and it worked for me:

I had got some of the boxes unchecked, so I checked them again, then it worked. Just go to

Windows > Preferences > Java > Editor > Content Assist > Advanced

and check the boxes which you want .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文