Eclipse不会生成import语句,停止显示Quick Fix建议 [英] Eclipse won't generate import statements, stopped showing Quick Fix suggestions
问题描述
import
语句,代码编译并运行正常。 我检查过我的构建路径,一切似乎是按顺序的 - 就像我说的那样,当我手动执行 import
语句时,代码运行,但是失去自动进口真的让我失望。任何想法可能出了什么问题?上个星期工作正常!
ETA:另一个注意事项,如果它有帮助:F3仍然打开类声明,所以Eclipse清楚地知道我是什么意思,即使没有导入声明。
另外:没有帮助的事情:
- 清洁所有项目
- 重新启动Eclipse
- 重新启动计算机
- 删除
.metadata
从工作区,重新导入项目
- 启动新的Java项目,重新链接源文件夹,重新添加依赖关系(不使用Maven,但这不是我的选择) / li>
感谢所有的帮助,大家,但事实证明是一个破坏的Eclipse安装。
我还没有弄清楚如何或什么被打破了,但我试图用一个Hello World类创建一个新项目。新类向导在类 org.eclipse.wst.jsdt.internal.core.dom.rewrite.ImportRewriteAnalyzer
中的创建元素失败错误。一旦我在Eclipse中遇到内部错误,我放弃了并从新的下载安装了一个新的Eclipse。
使用新的Eclipse,我得到了我的Quick Fix建议,以及自动进口。我猜,将来我会尝试重新安装Eclipse,然后再去寻找解决方案来掩盖以下错误: - /
My Eclipse installation suddenly stopped showing import suggestions. If I type a class name that isn't in the current package, autocomplete works fine and shows the class, but after picking from the drop-down, the class name is highlighted as an error with the message "MyClass cannot be resolved to a variable". This error shows no Quick Fix suggestions. However, if I manually add the relevant import
statement at the top of the file, the code compiles and runs fine.
I've checked my build path and everything appears to be in order -- and like I said, the code runs when I hand-jam the import
statement -- but losing automatic importing is really slowing me down. Any idea what could have gone wrong? It worked fine last week!
ETA: Another note, if it helps: F3 still opens the class declaration, so Eclipse clearly knows what I "mean", even without the import statement.
Also also: Things that have not helped:
- Clean all projects
- Restarting Eclipse
- Restart computer
- Delete
.metadata
from workspace, re-import project - Start new Java project, re-link source folder, re-add dependencies (not using Maven, but that's not my choice)
Thanks for all the help, everybody, but this turns out to have been a case of a broken Eclipse install.
I still haven't figured out exactly how or what was broken, but I tried to make a new project with a single "Hello World" class. The New Class wizard errored out with "Creation of element failed" in the class org.eclipse.wst.jsdt.internal.core.dom.rewrite.ImportRewriteAnalyzer
. Once I hit "internal errors" in Eclipse, I gave up and installed a fresh Eclipse from a new download.
With a new Eclipse, I got my Quick Fix suggestions back, as well as automatic imports. I guess in future I'll try reinstalling Eclipse before I go looking for solutions to obscure errors like this :-/
这篇关于Eclipse不会生成import语句,停止显示Quick Fix建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!