哪个 IDE 用于 Scala 2.8?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2615196/
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
Which IDE for Scala 2.8?
提问by ?ukasz Lew
采纳答案by Sean
I've been pretty successful with IDEA 9. I've briefly tried both Netbeans and Eclipse and wasn't able to get what I wanted. Eclipse's code-complete didn't behave as well as I'd have liked, and I couldn't find a way to make Netbeans handle Scala scripts; It'd just complain that the file wasn't a class.
我在 IDEA 9 上非常成功。我曾短暂尝试过 Netbeans 和 Eclipse,但没有得到我想要的。Eclipse 的代码完成没有我想要的那么好,而且我找不到让 Netbeans 处理 Scala 脚本的方法;它只是抱怨该文件不是一个类。
To be clear, I've been using IDEA for a few years for Java, so keep that in mind:)
需要明确的是,我已经在 Java 中使用 IDEA 几年了,所以请记住这一点:)
回答by Alexander Temerev
For the moment, Scala Plugin in IntelliJ IDEA is the best. It handles Scala 2.8 well. IntelliJ IDEA Community Edition is now free and open source (and works with Scala), so I can't see any reason for not using it.
目前,IntelliJ IDEA 中的 Scala 插件是最好的。它可以很好地处理 Scala 2.8。IntelliJ IDEA 社区版现在是免费和开源的(并且可以与 Scala 一起使用),所以我看不出有任何不使用它的理由。
The plugin is still somewhat buggy (many "false negatives", i.e. the code without red underscores may not compile successfully; but almost no "false positives"), but perfectly usable. The best thing is that you can use IDEA's excellent debugger with Scala (not without some issues, but it actually works!).
该插件仍有一些问题(许多“误报”,即没有红色下划线的代码可能无法成功编译;但几乎没有“误报”),但完全可用。最好的事情是您可以将 IDEA 出色的调试器与 Scala 一起使用(并非没有问题,但它确实有效!)。
FSC (Fast Scala Compiler) is also supported in latest builds. A huge time-saver.
最新版本也支持 FSC(快速 Scala 编译器)。一个巨大的节省时间。
The plugin development team is quite responsive. Some of the guys work directly in JetBrains and possess intimate knowledge about IDEA platform, so the development progresses fast.
插件开发团队非常敏感。有些人直接在JetBrains工作,对IDEA平台有深入的了解,所以开发进展很快。
回答by Randall Schulz
JetBrains IDEA's Scala plug-in handles 2.7 and 2.8 equally well.
JetBrains IDEA 的 Scala 插件同样可以很好地处理 2.7 和 2.8。
I cannot make any comparisons because I have used only IDEA.
我无法进行任何比较,因为我只使用了 IDEA。
回答by Ichthyo
Using Eclipse Helios with the dev-version of the new Scala(2.8) plugin, as there isn't an official release yet. That isbeta, definitively -- but I can't confirm the frequently expressed opinion that this plugin is outright horrible ;-)
将 Eclipse Helios 与新的 Scala(2.8) 插件的开发版本一起使用,因为还没有正式版本。那是测试版,绝对是 - 但我无法确认经常表达的观点,即这个插件非常可怕;-)
I'd say, the experience is already OK-ish, and indeed better than the current state of affairs with the Groovy plugin. OTOH, the experience with plain Java is way more smooth (feels like flying at times), and the current CDT I'd rate somewhat in between.
我想说的是,体验已经很不错了,确实比 Groovy 插件的当前状态要好。OTOH,使用普通 Java 的体验更加流畅(有时感觉像飞行),而当前的 CDT 则介于两者之间。
Incremental compile and error highlighting work quite well for me; tweaking a DSL implementation into form just by continuously rewriting your code until the error markers are gone -- without ever having to test-run your program -- is outright fun and just again shows that FP / static typing rocks!
增量编译和错误突出显示对我来说效果很好;仅仅通过不断重写代码直到错误标记消失来将 DSL 实现调整为形式——无需测试运行你的程序——非常有趣,而且再次表明 FP / 静态类型很酷!
Problems encountered from time to time: - implicits and nested types in other compilation units (esp. nested / super packages) aren't picked up at times when there are still other errors around; they will be picked up after an full build - there seems to be a memory leak in the version I'm using right now (from end august 2010), necessitating to restart the workbench after some hours of work - beware when you're using AspectJ, to make sure you get a version of the Scala plugin which relies on a JDT weaving bundle version which also works with AJDT
不时遇到的问题: - 其他编译单元(特别是嵌套/超级包)中的隐式和嵌套类型在仍然存在其他错误时不会被拾取;它们将在完整构建后被提取 - 我现在使用的版本中似乎存在内存泄漏(从 2010 年 8 月下旬开始),需要在工作几个小时后重新启动工作台 - 当你使用时要小心AspectJ,以确保您获得依赖于 JDT 编织包版本的 Scala 插件版本,该版本也适用于 AJDT
PS: I'm using maven builds in all my projects and generated the eclipse projects with the eclipse-maven-plugin, and then imported them as plain-flat eclipse projects. I can just strongly recommend everyone to keep away from the M2-eclipse plugin (for maven) in its current (2010) state, it makes your workbench painfully slow, is buggy and has lots of almost unpredictable behaviour, because it constantly tries to do magic things behind the scenes (and besides that, the aspectj support is broken since this spring)
PS:我在我所有的项目中都使用了 Maven 构建,并使用 eclipse-maven-plugin 生成了 Eclipse 项目,然后将它们作为普通 Eclipse 项目导入。我只能强烈建议每个人远离当前(2010 年)状态的 M2-eclipse 插件(对于 maven),它使您的工作台非常缓慢,有问题并且有很多几乎不可预测的行为,因为它不断尝试做幕后神奇的事情(除此之外,aspectj 支持自今年春天以来就被破坏了)
回答by Mohammad Reza Esmaeilzadeh
i use both eclipse and IDEA
我同时使用 Eclipse 和 IDEA
eclipse supports type detection is better than IDEA (it is very neccessery thing if you want program in functional style that you can be aware from type of expressions and variables.)
Edit1: IDEA supports type detection like eclipse but you have to define a value in your functions for example:
def testTs[A](a:List[String],b:List[A]) = for{ ai <- a bi <- b } yield (ai,bi) }should be converted todef testTs[A](a:List[String],b:List[A]):List[(String,A)]={ val result = for{ ai <- a bi <- b } yield (ai,bi) }also instead of hover your mouse over variables you must press ctrl+q when your mouse is hover on that variable- eclipse have some problems in code completion (when you use a variable in next line and you want get a property of this variable eclipse show wrong code suggestions)
- in IDEA ruining a scala application
is 5 sec slower than eclipse (there is some solution for bust IDEA run time but these have side effect have some problems)
in idea there is a well known problem with double click speed that show itself in many cases like opening a file or selecting an string in source... you can increase double click time out by creating (or editing) /home/.Xresources and add this line:
*.multiClickTime: 400
eclipse 支持类型检测比 IDEA 更好(如果你想要函数式风格的程序,你可以从表达式和变量的类型中知道这是非常必要的。)
Edit1:IDEA 支持像 eclipse 这样的类型检测,但你必须在你的函数中定义一个值,例如:
def testTs[A](a:List[String],b:List[A]) = for{ ai <- a bi <- b } yield (ai,bi) }应该转换为def testTs[A](a:List[String],b:List[A]):List[(String,A)]={ val result = for{ ai <- a bi <- b } yield (ai,bi) }也,而不是将鼠标悬停在变量上,当你的鼠标悬停在该变量上时,你必须按 ctrl+q- eclipse 在代码完成方面有一些问题(当你在下一行使用一个变量并且你想获得这个变量的属性时 eclipse 显示错误的代码建议)
- 在IDEA中破坏scala应用程序比eclipse慢5秒(有一些解决IDEA运行时的解决方案,但这些有副作用有一些问题)在idea中存在一个众所周知的双击速度问题,在许多情况下都会显示出来,例如打开文件或在源中选择一个字符串...您可以通过创建(或编辑)/home/.Xresources 并添加以下行来增加双击超时:
*.multiClickTime: 400
Edit1:in summery i prefer to use IDEA rather than eclipse
编辑 1:在夏天我更喜欢使用 IDEA 而不是 eclipse
回答by Raphael
A non-answer: None.
非答案:没有。
Based on what a perceived majority says, IDEA is probably the best Scala IDE today. And it (read: the Scala plugin) sucks. It does not handle fsc well, type inference is a mess, many errors are not shown, a number of non-errors are marked as errors, it is slow (when inspections are turned on), the test runner silently swallows aborting (!= failing) tests, ...
根据大多数人的看法,IDEA 可能是当今最好的 Scala IDE。它(阅读:Scala 插件)很糟糕。它不能很好地处理 fsc,类型推断是一团糟,许多错误没有显示,许多非错误被标记为错误,它很慢(打开检查时),测试运行器默默地吞下中止(!=失败)测试,...
So I switched to a simple text editor with syntax highlighting on one and a maximized shell with SBT (simple build tool) on the other screen. Awesome! SBT is responsive (you can let file changes trigger recompilation of affected code and even reruns of tests), manages dependencies very smoothly and has helpful output (esp for tests; using ScalaTest). SBT increased my productivity compared to IDEA a lot.
所以我切换到一个简单的文本编辑器,在一个屏幕上突出显示语法,在另一个屏幕上使用一个带有 SBT(简单构建工具)的最大化 shell。惊人的!SBT 响应迅速(您可以让文件更改触发受影响代码的重新编译,甚至重新运行测试),非常顺利地管理依赖项并提供有用的输出(尤其是测试;使用 ScalaTest)。与 IDEA 相比,SBT 大大提高了我的工作效率。
You lose code completion, of course, altough geany offers me identified symbols. But as long as IDEs don't get type inference to work properly code completion does not help, anyway.
当然,您会丢失代码完成功能,尽管 geany 为我提供了可识别的符号。但是只要 IDE 没有得到类型推断以正常工作,代码完成就无济于事,无论如何。
Some people care a lot about code refactoring. Well, the IDEs apparently don't make a good job there either. Even if they would, I'd rather only open them for this particular task than use them all the time.
有些人非常关心代码重构。嗯,IDE 显然在那里也做得不好。即使他们愿意,我也宁愿只为这个特定任务打开它们而不是一直使用它们。
回答by Carlos Quintanilla
I think that the best option so far is the ScalaIDE for Eclipse. You can go to the ScalaIDE Web Site and look around to see by yourself. http://scala-ide.org/
我认为目前最好的选择是 Eclipse 的 ScalaIDE。你可以去ScalaIDE的网站自己四处看看。 http://scala-ide.org/
Strong points I see about it are:
我看到的重点是:
- documentation,
- tutorials,
- constant releases,
- support from Typesafe.
- 文件,
- 教程,
- 不断的发布,
- 来自 Typesafe 的支持。
Here below a summary of the main features:
以下是主要功能的摘要:
Scala IDE provides support for development of Scala applications in the Eclipse platform. Its main target is the support for the Scala language and the integration with the Eclipse Java tools. It provides many of the features Eclipse users have come to expect including:
Scala IDE 为在 Eclipse 平台上开发 Scala 应用程序提供支持。它的主要目标是支持 Scala 语言以及与 Eclipse Java 工具的集成。它提供了 Eclipse 用户期望的许多功能,包括:
- Support for mixed Scala/Java projects and any combination of Scala/Java project dependencies. Type driven operations are transparent across Scala and Java files and projects, allowing straightforward references from Scala to Java and vice versa.
- A Scala editor with syntax highlighting, inferred type, hyperlinking to definitions, code completion, error and warning markers, indentation, brace matching.
- Project and source navigation including Scala support in the Package explorer view with embedded outline, outline view, quick outline, open type, open type hierarchy.
- Incremental compilation, application launching with integrated debugger, hyperlinking from stack traces to Scala source, interactive console.
- Support for Eclipse plug-in and OSGi development including hyperlinking to Scala source from plugin.xml and manifest files.
- 支持混合 Scala/Java 项目和 Scala/Java 项目依赖项的任意组合。类型驱动的操作在 Scala 和 Java 文件和项目之间是透明的,允许从 Scala 直接引用到 Java,反之亦然。
- 具有语法高亮、推断类型、定义超链接、代码完成、错误和警告标记、缩进、括号匹配的 Scala 编辑器。
- 项目和源代码导航包括包浏览器视图中的 Scala 支持,带有嵌入的大纲、大纲视图、快速大纲、开放类型、开放类型层次结构。
- 增量编译、使用集成调试器启动应用程序、从堆栈跟踪到 Scala 源的超链接、交互式控制台。
- 支持 Eclipse 插件和 OSGi 开发,包括从 plugin.xml 和清单文件超链接到 Scala 源。
UPDATE: the features and advantages are mentioned on this answer are for version 2.9 and 2.10 of Scala, because it has been already discontinued. see here:
更新:此答案中提到的功能和优点适用于 Scala 2.9 和 2.10 版,因为它已停产。看这里:
"The 2.0.1 release is only available for Scala 2.9, if you would like to use the Scala IDE with Scala 2.8, please install the 2.0.0 release (support for Scala 2.8 has been discontinued after the 2.0.0 version)"
“2.0.1 版本仅适用于 Scala 2.9,如果您想将 Scala IDE 与 Scala 2.8 一起使用,请安装 2.0.0 版本(2.0.0 版本后已停止对 Scala 2.8 的支持)”
回答by rs_atl
The officially endorsed and supported (by Typesafe) for Scala 2.9 is Eclipse. The current version is far superior to prior versions and includes a context-aware REPL, full-featured debugger, and even the ability to debug REPL statements. I think this question needs to be updated and the answers revisited.
Scala 2.9 官方认可和支持(由 Typesafe 提供)是 Eclipse。当前版本远远优于以前的版本,包括上下文感知 REPL、全功能调试器,甚至调试 REPL 语句的能力。我认为这个问题需要更新并重新审视答案。
回答by Horst Dehmer
My experiences clearly point to IntelliJ IDEA:
我的经验清楚地指向 IntelliJ IDEA:
About six months ago, when I started a serious Scala (multi module) project, I had to abandon Eclipse as my favorite Java IDE and switched to IntelliJ (9.0.x). Eclipse Scala IDE was way to buggy and often stopped responding at some point, even for the most simple projects. For CI (Hudson) and command line build, I depend on Maven (with Scala plugin). The Maven dependencies (incl. Scala libs) are picked up nicely by IntelliJ.
大约六个月前,当我开始一个严肃的 Scala(多模块)项目时,我不得不放弃 Eclipse 作为我最喜欢的 Java IDE,转而使用 IntelliJ (9.0.x)。Eclipse Scala IDE 存在问题,并且经常在某些时候停止响应,即使对于最简单的项目也是如此。对于 CI (Hudson) 和命令行构建,我依赖 Maven(带有 Scala 插件)。IntelliJ 很好地获取了 Maven 依赖项(包括 Scala 库)。
A few days back I updated to IDEA X (CE) with the current plugin (nightly build) and work became even smoother. Although fsc still terminates after a while when inactive.
几天前,我使用当前插件(每晚构建)更新到 IDEA X (CE),工作变得更加顺畅。尽管 fsc 在不活动时仍会在一段时间后终止。
From what I see, I'd like to add, that there seems to be way more activity on the IntelliJ side to respond to bugs and improve the plugin continuously. Correct me when I'm wrong, but Eclipse Scala IDE development seems almost stalled. Still no 'official' Helios release!
从我所见,我想补充一点,IntelliJ 方面似乎有更多活动来响应错误并不断改进插件。当我错了时纠正我,但 Eclipse Scala IDE 开发似乎几乎停滞不前。仍然没有“官方”Helios 版本!
NB: Just to provide some context (not bragging, really): The aforementioned project consists of about 25 Scala modules (POMs), 5 Java modules, 325 Scala files with a total of about 360 Scala classes, case classes and traits (> 19 kLOC, including comments). My platform is OS X 10.6, Scala 2.8.1, Java 1.6.
注意:只是提供一些上下文(不是吹牛,真的):上述项目由大约 25 个 Scala 模块(POM)、5 个 Java 模块、325 个 Scala 文件组成,总共有大约 360 个 Scala 类、案例类和特征(> 19 kLOC,包括评论)。我的平台是 OS X 10.6、Scala 2.8.1、Java 1.6。
UPDATE: After having the need for pretty extensive refactorings (mainly move class, rename package), I discovered that the recent IDEA 10.0.1 plugin 0.4.413 (and probably older versions, too) has quite some problems getting stuff right. I don't want to explain the specifics, but I (almost ever) ended up manually fixing unresolved references or otherwise messed-up code. You can have a look at http://youtrack.jetbrains.netto get an idea.
更新:在需要相当广泛的重构(主要是移动类,重命名包)之后,我发现最近的 IDEA 10.0.1 插件 0.4.413(也可能是旧版本)在正确处理东西方面存在很多问题。我不想解释细节,但我(几乎曾经)最终手动修复了未解析的引用或其他混乱的代码。您可以查看http://youtrack.jetbrains.net以获得一个想法。
For everyone who is really considering doing some serious development with Scala, I strongly recommend to evaluate the IDEs in question beyond the basics. When you are into an agile approach, which in my option requires a painless refactoring support without surprises (especially in multi-module projects), things are pretty tight at the moment.
对于真正考虑使用 Scala 进行一些认真开发的每个人,我强烈建议在基础知识之外评估有问题的 IDE。当您采用敏捷方法时,在我看来,它需要无意外的无痛重构支持(尤其是在多模块项目中),目前情况非常紧张。
It would be pretty neat, if someone came up with a IDE independent specification-like list of refactorings (and desired outcomes), which could be used to verify an IDE's refactoring support.
如果有人想出一个类似于 IDE 独立规范的重构(和预期结果)列表,可用于验证 IDE 的重构支持,那将非常简洁。
回答by Ivan
I am using the latest NetBeans and haven't tried anything else. I've met at least 2 notable bugs in NetBeans while coding in Scala:
我正在使用最新的 NetBeans 并且没有尝试过其他任何东西。在 Scala 中编码时,我在 NetBeans 中遇到了至少 2 个值得注意的错误:
One: NB occasionally come unable to run a program, hanging on classpath scanning.
Solution: Create a new project, copy your code there and go on.
Comment: This bug is more than 10 years old.
一:NB偶尔来个程序无法运行,挂在classpath扫描上。
解决方案:创建一个新项目,在那里复制您的代码并继续。
评论:这个bug已经有10多年了。
Two: Sometimes NB can't see membersof particular namespaces or classes and complains when you use them.
Solution: Just ignore and go on - compiler founds no errors and the program works.
二:有时NB看不到特定命名空间或类的成员,在使用时会报错。
解决方案:忽略并继续 - 编译器没有发现错误并且程序可以运行。

