Eclipse:使用“开放声明” ...在 Scala 项目中
几个月来我一直在尝试从 Java 转换为 Scala,发现最大的障碍是 Scala 的 Eclipse 插件并不比使用 Vim 好。
我通常会打开“自动构建”,因此除了“打开”和“保存”之外,我最常使用的命令是:
Open Declaration (F3)
References > Workspace (Ctrl-Shift-G)
Open Type Hierarchy (F4)
Open Type (Ctrl-Shift-T)
Content Assist (Ctrl-Space)
以及查看大纲。
这些都不适用于库的 Scala IDE。有些东西适用于我自己的代码,比如大纲。但其余的只是返回以下错误:
该资源不在 Java 项目的构建路径上。
有什么方法可以让这些东西在 Eclipse 中工作吗?没有它们,基本上我得到的唯一东西就是语法高亮和保存时编译,并且我可以从 vim 获得语法高亮,而不需要 1.5 GB 的内存...
使用隐式和静态函数导入,找出某些东西来自哪里没有F3真的很难。我最终使用谷歌来查找什么类别/特征定义了什么。
[编辑] 我刚刚拉取了 Eclipse Classic 3.6.2,并且 update-1.0.0-milestones-2.8.1.final,我上次检查时不可用。他们已经修复了大纲和“开放式”,仅此而已。剩下的还是不行。
I've been trying to convert from Java to Scala for a few months, and found that the greatest roadblock is that Eclipse plugin for Scala is hardly better then using Vim.
I normally have "Build Automatically" on, so apart from Open and Save, the commands I use most of the time are:
Open Declaration (F3)
References > Workspace (Ctrl-Shift-G)
Open Type Hierarchy (F4)
Open Type (Ctrl-Shift-T)
Content Assist (Ctrl-Space)
and looking at the Outline.
None of this works with the Scala IDE for the libraries. Some stuff works for my own code, like outline. But the rest just returns the following error:
The resource is not on the build path of a Java project.
Is there any way to get any of those things to work in Eclipse? Without them, basically the only thing I get is syntax highlight and compile-on-save, and I can get syntax highlight from vim without needing 1.5 GB of ram...
With implicits, and static function import, finding out from where something comes is really difficult without F3. I ended up using Google to find what class/trait defines what.
[EDIT] I just pulled Eclipse Classic 3.6.2, and update-1.0.0-milestones-2.8.1.final, which wasn't available the last time I checked. They have fixed the Outline, and "Open Type", that's it. The rest still doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的是哪个版本的 Eclipse 插件?如果该版本是不久前的,那么你是对的,它有点错误。
但是,有一个新版本,目前处于测试阶段(截至 2011 年 4 月 23 日),可从 Scala IDE Eclipse 下载站点< /a>.这好多了。
另外,请确保在 Scala -> 安装诊断窗口中选中“使用 JDT 内容辅助”复选框。
请尝试新版本,看看是否可以解决您的问题。如果没有,请提出错误,团队将修复它。
Which version of the Eclipse plugin are you using? If the version is from a while ago, then you're right, it's a bit buggy.
However, there is a new version, currently in beta (as of 23.04.2011) available from Scala IDE Eclipse download site. This is a lot better.
Also, please make sure that the 'Use JDT content assists' checkboxes are checked in Scala->Setup diagnostics window.
Please try the new version, and see if it fixes your problems. If not, raise a bug, and the team will fix it.