Scala 2.8 适合哪个 IDE?

发布于 2024-11-07 04:39:07 字数 1539 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

风启觞 2024-11-14 04:39:08

我的经历清楚地指向 IntelliJ IDEA:

大约六个月前,当我开始一个严肃的 Scala(多模块)项目时,我不得不放弃 Eclipse 作为我最喜欢的 Java IDE,转而使用 IntelliJ (9.0.x)。 Eclipse Scala IDE 存在很多问题,并且经常在某些时候停止响应,即使对于最简单的项目也是如此。对于 CI (Hudson) 和命令行构建,我依赖 Maven(带有 Scala 插件)。 IntelliJ 很好地获取了 Maven 依赖项(包括 Scala 库)。

几天前,我使用当前插件(每晚构建)更新到 IDEA X (CE),工作变得更加顺利。尽管 fsc 在非活动状态一段时间后仍会终止。

据我所知,我想补充一点,IntelliJ 方面似乎有更多的活动来响应错误并不断改进插件。如果我错了,请纠正我,但 Eclipse Scala IDE 开发似乎几乎陷入停滞。仍然没有“官方”Helios 版本!

注意:只是提供一些背景信息(不是吹牛,真的):上述项目由大约 25 个 Scala 模块(POM)、5 个 Java 模块、325 个 Scala 文件组成,总共大约 360 个 Scala 类、案例类和特征(> 19 kLOC,包括注释)。我的平台是 OS X 10.6、Scala 2.8.1、Java 1.6。

更新:在需要进行相当广泛的重构(主要是移动类、重命名包)之后,我发现最近的 IDEA 10.0.1 插件 0.4.413(可能还有旧版本)在正确处理方面存在相当多的问题。我不想解释具体细节,但我(几乎曾经)最终手动修复了未解析的引用或其他混乱的代码。您可以查看 http://youtrack.jetbrains.net 来了解一下。

对于真正考虑使用 Scala 进行认真开发的每个人,我强烈建议在基础知识之外评估相关 IDE。当您采用敏捷方法时,在我看来,这种方法需要无痛的重构支持而不会出现意外(特别是在多模块项目中),目前情况非常紧张。

如果有人想出一个独立于 IDE 规范的重构列表(以及期望的结果),可以用来验证 IDE 的重构支持,那就太好了。

My experiences clearly point to 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.

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.

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!

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.

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.net to get an idea.

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.

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.

云朵有点甜 2024-11-14 04:39:08

无答案:没有。

根据大多数人的看法,IDEA 可能是当今最好的 Scala IDE。它(阅读:Scala 插件)很糟糕。它不能很好地处理 fsc,类型推断一团糟,许多错误没有显示,许多非错误被标记为错误,速度很慢(当打开检查时),测试运行程序默默地吞下中止(!=失败)测试,...

所以我切换到一个简单的文本编辑器,其中一个屏幕上有语法突出显示,另一个屏幕上有一个带有 SBT(简单构建工具)的最大化 shell。惊人的! SBT 具有响应能力(您可以让文件更改触发受影响代码的重新编译,甚至重新运行测试),非常顺利地管理依赖项并提供有用的输出(特别是用于测试;使用 ScalaTest)。与 IDEA 相比,SBT 极大地提高了我的工作效率。

当然,尽管 geany 为我提供了已识别的符号,但您会失去代码完成功能。但只要 IDE 无法使类型推断正常工作,代码完成就无济于事。

有些人非常关心代码重构。嗯,IDE 显然在这方面也做得不好。即使他们愿意,我也宁愿只为这个特定任务打开它们,而不是一直使用它们。

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, ...

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.

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.

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.

白云不回头 2024-11-14 04:39:08

我认为迄今为止最好的选择是 ScalaIDE for Eclipse。你可以去ScalaIDE网站自行查看一下。
http://scala-ide.org/

我看到的优点是:

  • 文档、
  • 教程、
  • 不断发布,
  • 来自 Typesafe 的支持。

下面总结了主要功能:

Scala IDE 为在 Eclipse 平台上开发 Scala 应用程序提供支持。其主要目标是支持Scala 语言以及与Eclipse Java 工具的集成。它提供了 Eclipse 用户所期望的许多功能,包括:

  • 支持混合 Scala/Java 项目以及 Scala/Java 项目依赖项的任意组合。类型驱动的操作在 Scala 和 Java 文件和项目中是透明的,允许从 Scala 到 Java 的直接引用,反之亦然。
  • Scala 编辑器,具有语法突出显示、推断类型、定义超链接、代码完成、错误和警告标记、缩进、大括号匹配。
  • 项目和源代码导航,包括包资源管理器视图中的 Scala 支持,具有嵌入式大纲、大纲视图、快速大纲、开放类型、开放类型层次结构。
  • 增量编译、使用集成调试器启动应用程序、从堆栈跟踪到 Scala 源代码的超链接、交互式控制台。
  • 支持 Eclipse 插件和 OSGi 开发,包括从 plugin.xml 和清单文件超链接到 Scala 源。

更新:这个答案中提到的功能和优点适用于 Scala 2.9 和 2.10 版本,因为它已经停产了。请参阅此处:

“2.0.1版本仅适用于Scala 2.9,如果您想在Scala 2.8中使用Scala IDE,请安装2.0.0版本(2.0之后对Scala 2.8的支持已停止) .0版本)

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/

Strong points I see about it are:

  • documentation,
  • tutorials,
  • constant releases,
  • support from 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:

  • 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.

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:

"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)"

当梦初醒 2024-11-14 04:39:08

Scala 2.9 的官方认可和支持(由 Typesafe)是 Eclipse。当前版本远远优于以前的版本,包括上下文感知的 REPL、全功能调试器,甚至能够调试 REPL 语句。我认为这个问题需要更新并重新审视答案。

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.

往日情怀 2024-11-14 04:39:08

我不推荐 Scala IDE/Eclipse。它没有很多甚至可用于带有 Java 的 Eclipse 的功能。并且存在错误。

I don't recommend the Scala IDE/Eclipse. It doesn't have a lot of the features that are even available for Eclipse with Java. And there are bugs.

聚集的泪 2024-11-14 04:39:08

我正在使用最新的 NetBeans,没有尝试过其他任何东西。在 Scala 中编码时,我在 NetBeans 中至少遇到了 2 个值得注意的错误:

其一:NB 有时无法运行程序,挂在类路径扫描上。
解决方案:创建一个新项目,将代码复制到其中并继续。
评论:此错误已有 10 多年历史

二:有时注意 可以'看不到特定名称空间或类的成员,并在使用它们时抱怨。
解决方案:忽略并继续 - 编译器没有发现错误并且程序可以运行。

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:

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.

Two: Sometimes NB can't see members of particular namespaces or classes and complains when you use them.
Solution: Just ignore and go on - compiler founds no errors and the program works.

ま柒月 2024-11-14 04:39:08

我现在推荐IDEA的插件。

NetBeans 的 Scala 插件也非常好。不过,它还不支持最新版本的 NetBeans 6.9,您仍然需要手动下载它,而不是直接从 NetBeans 内的插件管理器安装。

然而,它与 Maven 项目的集成比 IDEA 的插件更好(在我看来,对于 NB 和 IDEA 一般来说都是如此)。

I'd recommend IDEA's plugin for now.

The Scala plugin for NetBeans is quite nice too. It doesn't yet support NetBeans 6.9, the newest release, though, and you still need to download it manually instead of installing it directly from the plugin manager inside NetBeans.

However, it integrates better with Maven projects than IDEA's plugin does (this is true for NB and IDEA in general, in my opinion).

奢欲 2024-11-14 04:39:08

这在一定程度上取决于您的工作风格,因为所有选项都有优点和缺点。

如果您需要跨混合 java/scala 项目进行重构,那么 IntelliJ 是您唯一的选择。

如果您想对编译器或编译器插件执行任何工作,那么 Eclipse 的优势在于能够使用自定义编译器构建(包括断点)启动运行时工作区。它在 2.8 Scala 版本中也得到了巨大的改进。

如果您已经非常熟悉该平台,那么 Netbeans 是一个不错的选择,学习新环境的成本可能远远超过任何好处,并且所有三种解决方案都在快速改进。

It partly depends on your style of working, as all the options have strengths and weaknesses.

If you need refactoring across mixed java/scala projects, then IntelliJ is your only option.

If you want to do any work on the compiler or a compiler plugin, then Eclipse has the advantage of being able to launch a runtime workspace with a custom compiler build, including breakpoints. It also improved massively for the 2.8 Scala release.

Netbeans is a fine choice to go with if you're already very familiar with that platform, the costs of learning a new environment may well outweigh any benefits, and all three solutions are improving rapidly.

贩梦商人 2024-11-14 04:39:08

我还没有尝试过 netbeans scala 插件,但我发现 Intellij IDEA 插件无论如何都是比 Scala eclipse 插件更好的 scala ide,后者太慢了,让我抓狂。
尽管 Swing 应用程序不能与我的平铺窗口管理器很好地配合。

I haven't tried netbeans scala plugin yet, but I find that Intellij IDEA plugin is at any way much better a scala ide than the Scala eclipse plugin, which is sooooo slow that drives me crazy.
Though swing applications don't work well with my tiling window manager.

缱绻入梦 2024-11-14 04:39:08

尝试一下 IDEAX,Intellij IDEA 的最新社区版本(版本 10),它改进了 scala 插件,除了具有更快的代码编译和执行速度之外
Maven3 和 SBT 支持,我们可以使用它们来开发 Lift 应用程序。

try IDEAX the latest community edition of Intellij IDEA (version 10), it has improved scala plugin which has faster code compilation and exceution in addition to that it has
Maven3 and SBT support with which we can develop Lift applications.

甜宝宝 2024-11-14 04:39:08

IntelliJ IDEA 社区版 + Scala 插件 + SBT 插件

IntelliJ IDEA community edition + Scala Plugin + SBT plugin

能否归途做我良人 2024-11-14 04:39:08

对于最新版本(2021),哪个 ide 占据主页大部分的问题 https://scala-lang.org /

For recent versions (2021) the question which ide takes a big portion of the home page https://scala-lang.org/

无妨# 2024-11-14 04:39:07

我使用 IDEA 9 非常成功。我曾短暂尝试过 Netbeans 和 Eclipse,但未能获得我想要的结果。 Eclipse 的代码完整表现并不如我所希望的那样好,而且我找不到使 Netbeans 处理 Scala 脚本的方法;它只是抱怨该文件不是一个类。

需要明确的是,我已经使用 IDEA 来处理 Java 几年了,所以请记住这一点:)

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.

To be clear, I've been using IDEA for a few years for Java, so keep that in mind:)

枫以 2024-11-14 04:39:07

目前来看,IntelliJ IDEA 中的 Scala Plugin 是最好的。它可以很好地处理 Scala 2.8。 IntelliJ IDEA 社区版现在是免费且开源的(并且可以与 Scala 一起使用),所以我看不出有什么理由不使用它。

该插件仍然有些错误(许多“误报”,即没有红色下划线的代码可能无法成功编译;但几乎没有“误报”),但完全可用。最好的一点是,您可以将 IDEA 出色的调试器与 Scala 一起使用(并非没有一些问题,但它确实有效!)。

最新版本还支持 FSC(快速 Scala 编译器)。节省大量时间。

插件开发团队反应非常灵敏。其中一些人直接在 JetBrains 工作,对 IDEA 平台有深入的了解,因此开发进展很快。

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.

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!).

FSC (Fast Scala Compiler) is also supported in latest builds. A huge time-saver.

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.

独﹏钓一江月 2024-11-14 04:39:07

JetBrains IDEA 的 Scala 插件同样可以很好地处理 2.7 和 2.8。

我无法进行任何比较,因为我只使用过IDEA。

JetBrains IDEA's Scala plug-in handles 2.7 and 2.8 equally well.

I cannot make any comparisons because I have used only IDEA.

黑白记忆 2024-11-14 04:39:07

将 Eclipse Helios 与新 Scala(2.8) 插件的开发版本一起使用,因为尚未正式发布。那测试版,绝对的——但我无法证实经常表达的观点,即这个插件是彻头彻尾的可怕;-)

我想说,体验已经不错了,而且确实比Groovy 插件的当前状况。 OTOH,使用普通 Java 的体验更加流畅(有时感觉就像在飞行),而当前的 CDT 我认为介于两者之间。

增量编译和错误突出显示对我来说效果很好;只需不断重写代码直到错误标记消失即可将 DSL 实现调整为形式 - 无需测试运行你的程序 - 非常有趣,并且再次表明 FP / 静态类型很棒!

时不时遇到的问题:
- 当仍然存在其他错误时,有时不会拾取其他编译单元(尤其是嵌套/超级包)中的隐式和嵌套类型;它们将在完整构建后被拾取
- 我现在使用的版本(从 2010 年 8 月末开始)似乎存在内存泄漏,需要在工作几个小时后重新启动工作台
- 当你使用 AspectJ 时要小心,以确保你获得的 Scala 插件版本依赖于 JDT 编织捆绑版本,该版本也适用于 AJDT

PS:我在所有项目中使用 Maven 构建并生成 Eclipse 项目使用 eclipse-maven-plugin,然后将它们作为普通 Eclipse 项目导入。我强烈建议大家远离当前(2010)状态的 M2-eclipse 插件(针对 Maven),它会让你的工作台变得非常慢,有 bug,并且有很多几乎不可预测的行为,因为它不断地尝试做幕后的神奇事物(除此之外,自今年春天以来,aspectj 支持就被打破了)

Using Eclipse Helios with the dev-version of the new Scala(2.8) plugin, as there isn't an official release yet. That is beta, definitively -- but I can't confirm the frequently expressed opinion that this plugin is outright horrible ;-)

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.

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!

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

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)

微凉徒眸意 2024-11-14 04:39:07

我同时使用eclipse和IDEA

  1. eclipse支持类型检测是
    比IDEA好(非常
    如果你想要程序的话,这是必需的东西
    以实用的风格,您可以
    从表达式的类型和
    变量。)

    <小时>

    Edit1:IDEA 支持像 eclipse 一样的类型检测,但你有
    在函数中定义一个值
    例如:def
    testTs[A](a:列表[字符串],b:列表[A])
    = 为{
    ai <- a
    bi < - b
    } Yield (ai,bi) }
    应转换为 def
    testTs[A](a:列表[字符串],b:列表[A]):列表[(字符串,A)]={
    验证结果 = for{
    ai <- a
    bi < - b
    } yield (ai,bi) }
    另外,当鼠标悬停在该变量上时,您必须按 ctrl+q,而不是将鼠标悬停在该变量上

  2. eclipse 在代码中存在一些问题
    完成(当您使用变量
    在下一行,你想要得到一个
    这个变量 eclipse 的属性
    在 IDEA 中显示错误的代码建议)
  3. 破坏了 scala 应用程序
    比 eclipse 慢 5 秒(有一些解决 IDEA 运行时间问题的解决方案,但这些解决方案有副作用,有一些问题)
    在想法中,双击速度存在一个众所周知的问题,在许多情况下都会出现,例如打开文件或在源中选择字符串...您可以通过创建(或编辑)/home/.Xresources 和添加此行: *.multiClickTime: 400

Edit1: 在夏天我更喜欢使用 IDEA 而不是 eclipse

i use both eclipse and IDEA

  1. 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 to def
    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

  2. 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)
  3. 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

Edit1: in summery i prefer to use IDEA rather than eclipse

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文