Eclipse Java Content Assist 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1367306/
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 Java Content Assist not working
提问by Damo
The Content Assist in Eclipse 3.4 and 3.5 has stopped working for me. When I type in the first few characters of a class and hit CRTL-space then after a delay I get the following error message alt text http://locuslive.com/webdrive/JDTscreenshot.png
Eclipse 3.4 和 3.5 中的 Content Assist 已停止对我来说有效。当我输入一个类的前几个字符并点击 CRTL-space 然后在延迟之后我收到以下错误消息 alt text http://locuslive.com/webdrive/JDTscreenshot.png
It does not matter what proposals I enable/disable, I will get this (or similar) message.
无论我启用/禁用什么建议,我都会收到此(或类似)消息。
I have tried:
我试过了:
Changing the Xms/Xmx values
Starting Eclipse with -clean
Creating a new workspace and importing my projects
更改 Xms/Xmx 值
使用 -clean 启动 Eclipse
创建一个新的工作区并导入我的项目
However none of these have worked.
然而,这些都没有奏效。
I have seen some posts suggesting that other apps may be taking over the CRTL-space or otherwise interfering, however I have nothing aside from a fresh Eclipse running and the problem persists.
我看到一些帖子暗示其他应用程序可能正在接管 CRTL 空间或以其他方式进行干扰,但是除了运行新的 Eclipse 之外我什么都没有,并且问题仍然存在。
My problem is very similar to the one covered in this postalbeit on a later version and on OSX 10.5.7.
我的问题与这篇文章中涵盖的问题非常相似,尽管是在更高版本和 OSX 10.5.7 上。
Does anyone have any suggestions for how this might be resolved?
有没有人对如何解决这个问题有任何建议?
Thanks.
谢谢。
UPDATE: To anyone interested I've had the best results by using Eclipse 3.5 Classic (ie. doesn't include Mylyn). I've also used the settings specified in the bug reports linked to by VonC below.
更新:对于任何感兴趣的人,我使用 Eclipse 3.5 Classic 获得了最好的结果(即不包括 Mylyn)。我还使用了下面由 VonC 链接的错误报告中指定的设置。
Interestingly Classic doesn't come with some views eg. Snippets, but these are easy to drop in from another distro.
有趣的是,经典没有一些观点,例如。片段,但这些很容易从另一个发行版中删除。
UPDATE 2: This problem actually persisted even with the latest versions of Eclipse (3.6 M1). It is caused by a large JAR file generated my Altova Mapforce to handle EDIFACT transformations in our application. It is reproducible by adding this JAR to the buildpath and no changes to Content Assist settings help. The bug (and JAR) can be seen at https://bugs.eclipse.org/bugs/show_bug.cgi?id=289057
更新 2:即使使用最新版本的 Eclipse (3.6 M1),这个问题实际上仍然存在。这是由我的 Altova Mapforce 生成的大型 JAR 文件引起的,该文件用于处理我们应用程序中的 EDIFACT 转换。通过将此 JAR 添加到构建路径并且无需更改 Content Assist 设置帮助即可重现。该错误(和 JAR)可以在https://bugs.eclipse.org/bugs/show_bug.cgi?id=289057上看到
采纳答案by VonC
the Mylyn FAQdoes mention:
Mylyn 常见问题解答确实提到:
Why do I get an error message when using content assist?
为什么在使用内容辅助时会收到错误消息?
If after invoking Content Assist you see an error message dialog that states:
如果在调用 Content Assist 后您看到一个错误消息对话框,说明:
The extension took too long to return from the 'computeCompletionProposals()' operation
this is most likely due to something interrupting the proposal operation (e.g. garbage collection). Ignore it if it does not recur, increase Eclipse's memory if it does (e.g via -Xmx384M command line argument). See bug 141457for more details.
这很可能是由于某些东西中断了提案操作(例如垃圾收集)。如果它不再出现,则忽略它,如果它出现,则增加 Eclipse 的内存(例如,通过 -Xmx384M 命令行参数)。有关更多详细信息,请参阅错误 141457。
Note that Mylyn should only add a trivial amount of overhead to content assist computation, however, the standard content assist mechanism will not report timeouts of this sort (i.e. taking longer than 5s to compute proposals).
If the system that you are working on is so large that increasing memory does not reduce the timings to avoid the message, you could also consider disabling the Mylyn-specific content assist, as described above, but if doing so please comment on bug 141457.
请注意,Mylyn 应该只为内容辅助计算添加微不足道的开销,但是,标准的内容辅助机制不会报告此类超时(即计算建议的时间超过 5 秒)。
如果您正在使用的系统太大以致于增加内存不会减少避免该消息的时间,您还可以考虑禁用特定于 Mylyn 的内容辅助,如上所述,但如果这样做,请对错误 141457发表评论。
You can find good eclipse settings in this SO answer.
Since you have already try increasing memory, you can leave a comment on the bug 141457.
您可以在此SO answer 中找到良好的日食设置。
由于您已经尝试增加内存,您可以对错误141457发表评论。
This could be related to the bug 281871, only fixed in eclipse 3.5.1 and 3.6.
这可能与错误 281871相关,仅在 eclipse 3.5.1 和 3.6 中修复。
I see it now. The problem is that code assist starts to use the Java model if the index is not yet up to date.
You can either wait until the indexer is done or increase the timeout by setting the '
org.eclipse.jdt.ui.codeAssistTimeout
' Java environment variable when starting Eclipse, e.g.
我现在看到了。问题是如果索引不是最新的,代码辅助就会开始使用 Java 模型。
您可以等到索引器完成或通过
org.eclipse.jdt.ui.codeAssistTimeout
在启动 Eclipse 时设置 ' ' Java 环境变量来增加超时,例如
-vmargs -Dorg.eclipse.jdt.ui.codeAssistTimeout=60000
回答by Sebastian Juarez
I′ve runned onto the same, Content Assist not working under Eclipse 3.7.2. Up to this version is pretty stable, tough I don′t know how come it never worked for me.
我遇到了同样的问题,Content Assist 在 Eclipse 3.7.2 下不起作用。直到这个版本都相当稳定,很难,我不知道它为什么对我不起作用。
I haven′t had any error message nor tip on why it wasn′t working and took me a while to find the 'Java Proposals' option.
我没有收到任何错误消息,也没有提示它为什么不起作用,我花了一段时间才找到“Java 建议”选项。
It is on Eclipse Preferences -> Java -> Editor -> Content Assist -> Advanced.
它位于 Eclipse Preferences -> Java -> Editor -> Content Assist -> Advanced。
Make sure that Java Proposals is checked.
确保选中 Java Proposals。
You don′t wan′t repeated Java suggestions. Don′t check Java Non-Type Proposal nor Java Type Proposals.
您不想重复 Java 建议。不要检查 Java Non-Type Proposal 或 Java Type Proposals。
回答by Manish
For me it works by doing prefrerences > general > keys > Restore Defaults
对我来说,它的工作原理是执行偏好 > 常规 > 键 > 恢复默认值
Dont know its crazy but thats what finally works after all the googling and trail following.
不知道它的疯狂,但这就是在所有谷歌搜索和跟踪之后最终有效的方法。
Regards, Manish
问候, 曼尼什
回答by Paul Whelan
Looks like your mylyn install may be broken try removing the mylyn plugin and see how you get on.
看起来您的 mylyn 安装可能已损坏,请尝试删除 mylyn 插件并查看您的进展情况。
回答by Daniel Martin
When I had a similar problem, I simply uninstalled the Mylyn/Java integration. I don't use Mylyn, and although I know some people consider it to be the best thing since sliced bread, I've never found it to be anything other than a way to screw my name completion.
当我遇到类似问题时,我只是卸载了 Mylyn/Java 集成。我不使用 Mylyn,虽然我知道有些人认为它是自切片面包以来最好的东西,但我从来没有发现它只是一种让我的名字补全的方法。
Note that you don'twant to disable the "Java Proposals (Task-Focused)" that that error message was trying to tell you about. That'll disable name completion as well.
请注意,您不希望禁用的“Java建议(以任务为中心)”是该错误信息是想给大家介绍一下。这也将禁用名称完成。
回答by Hrvoje
Configure Eclipse's content assist, go “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Other Java Proposals” is ticked. This may be easier solution... :-)
配置 Eclipse 的内容辅助,转到“Preferences>Java>Editor>Content Assist>Advanced”。确保勾选“其他 Java 提案”。这可能是更简单的解决方案... :-)
回答by Hrvoje
I was having the same issue, but my problems started when i upgrade my project from gwt 1.5 to gwt 1.7. I read your comments and i just make two changes. Increase the Xmx to -Xmx768m and unmark Java Proposals (Task-Focused) and mark just Java Proposals. It's being work fine since i did this changes. I hope it can help you.
我遇到了同样的问题,但是当我将项目从 gwt 1.5 升级到 gwt 1.7 时,我的问题就开始了。我阅读了您的评论,我只做了两个更改。将 Xmx 增加到 -Xmx768m 并取消标记 Java Proposals (Task-Focused) 并仅标记 Java Proposals。自从我做了这个更改后,它工作正常。我希望它能帮助你。
回答by Thomas
I had the same issue on eclipse 3.5. Upgrading mylyn features resolved it
我在 eclipse 3.5 上遇到了同样的问题。升级 mylyn 功能解决了它
回答by Tobias
Mylyn (or its code assist) seems to be rather picky about resources in the build path.
Mylyn(或其代码辅助)似乎对构建路径中的资源相当挑剔。
I had the issue and it was caused by binary files which I had accidentally added to the Eclipse built path. That does not cause any compile error or warnings but causes the exception during code completion you mention in your post.
我遇到了这个问题,它是由我不小心添加到 Eclipse 构建路径中的二进制文件引起的。这不会导致任何编译错误或警告,但会在您在帖子中提到的代码完成期间导致异常。
回答by User1
One of my jars was on a network share and it was hanging for over 10 seconds. Copied the JAR to local drive, updated my project to point to the local file and my hang time went away.
我的一个罐子在网络共享上,它挂了超过 10 秒。将 JAR 复制到本地驱动器,更新我的项目以指向本地文件,我的挂起时间消失了。