Eclipse 智能感知?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2943131/
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
Eclipse Intellisense?
提问by Ian Vink
How do I tell Eclipse to automatically make suggestions as I type? I'm looking for a Visual Studio Intellisense-like feature with Resharper.
我如何告诉 Eclipse 在我输入时自动提出建议?我正在寻找具有 Resharper 的类似于 Visual Studio Intellisense 的功能。
Currently I have to press CTRL+Spaceeach time.
目前我每次都必须按CTRL+ Space。
采纳答案by Daff
You don't have to press CTRL* spacebut maybe the delay is too big or you don't like the trigger (default is '.'). Go to
您不必按CTRL*space但可能延迟太大或您不喜欢触发器(默认为“.”)。去
Window -> Preferences -> Java/Editor/Content Assist
窗口 -> 首选项 -> Java/编辑器/内容辅助
And change the settings under Auto Activationto your likings.
并根据自己的喜好更改自动激活下的设置。
If this does not work for windows users then see this answer.
如果这对 Windows 用户不起作用,请参阅此答案。
回答by Tony
I've get closer to VisualStudio-like behaviour by setting the "Autocomplete Trigger for Java" to
通过将“Java 自动完成触发器”设置为,我更接近于类似 VisualStudio 的行为
.(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
and setting delay to 0.
并将延迟设置为 0。
Now I'd like to realize how to make it autocomplete method name when I press ( as VS's Intellisense does.
现在我想知道如何在按下时使其自动完成方法名称(就像 VS 的 Intellisense 所做的那样。
回答by d3dave
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 :)
(特别按使用顺序排列以提高性能:)
回答by Rok Strni?a
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:
如果即使您已经启用了 Code Assist,它也不起作用,则 Eclipse 的配置文件可能已损坏。对我有用的解决方案(在 Eclipse 3.5.2 上)是:
- Close Eclipse.
- Rename the workspace directory.
- Start Eclipse. (This creates a new workspace directory.)
- Import (with copy) the Java projects from the old workspace.
- 关闭日食。
- 重命名工作区目录。
- 启动日食。(这会创建一个新的工作区目录。)
- 从旧工作区导入(带复制)Java 项目。
回答by user3074382
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
Windows > 首选项 > Java > 编辑器 > 内容辅助 > 高级
and check the boxes which you want .
并选中您想要的框。
回答by MuhsinFatih
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:
d3dave 的回答很酷。然而 theGreenGarbage 提到了一个我也觉得很烦人的问题。所以这里有一个在 '=' 符号之后和输入空格时不会立即提示的内容:
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 .(!+-*/~,[{@#$%^&