20100106

The best Scala IDE: IntelliJ IDEA

After years and years of using Eclipse (after Netbeans, JBuilder, Visual Cafe, Emacs and other spooky Java "editors") IntelliJ IDEA is powerful, convenient and simple to use IDE for Scala development. Oh, yes it's free: IntelliJ IDEA Community edition.

I tried IDEA because the Scala plug-in for Eclipse is so horrible. I works so badly that using good old jEdit with some macros is way better. On a small project I had to clean the whole project for every compile. It's so bad. After several tries (starting sometime in 2008) I've given up on this thing.

Before IDEA I also tried to use Netbeans, but it failed the dump-developer-that-does-not-read-the-manual-test. Basic functionality should be usable without a detailed study of the documentation. That worked for me with IDEA but I could not get the plugin Scala plugin to run in Netbeans. It's probably me and everything is fine with Netbeans. Still I've invested less time to get things done with IDEA. It simply worked.

The simple summary: every basic IDE feature works: syntax high lighting, compiling, debugging, navigation and outline.

If you worried about productivity of Scala development because it was missing IDE support: stop worrying. The support is here.

I'm a heavy short cut user so using a new IDE slows me down naturally. Using the Eclipse key map was not an option for me. This works only 80% of the time. The main problem is that functionality with the same shortcuts behaves slightly different. That's maddening at the long run. So it's better to learn a new set of short cuts. It's like driving in Great Britain. It's easier when you are using a car with the steering wheel on the right. Driving a car with the steering wheel on the left is dangerous. There are the country side hedges where you'll see practically nothing in a left turn and chances are that you're going to start your trip on the right hand side on a calm country road. So better relearn.

Interestingly IDEA has a code analysis tool that does spell checking in comments, methods and variables names. This is already works for Scala. Eclipse does spell checking only in comments. This is a boon for code quality. You do not want to read incorrectly spelled source code. This is plain annoying to read, fix and frankly to get right (camel case does not make it easier). (The code analysis tool for Java is very good. It finds tons and tons of problems after FindBugs. I have not heard about the analysis tool before. It would be nice if it could be integrated in build tools and used in a continuous integration environments.)

The maven support seems to work out of the box. It reads a pom.xml and builds IDEA project files from it. It still uses its internal build infrastructure. With Eclipse you have to manually generate the .project and .classpath files which works but is an extra step and the eclipse specific configuration in pom files can get quite clunky.

The essential things work for Scala. You have code completion without implicit type conversion information. I suppose the support for implicit type conversion is quite hard to implement. There are a lot of callable members with type conversion for a given object. I suppose the best way to implement this would be a 2-step process. First show all directly reachable members and after hitting Ctrl + Shift again show all reachable members. Methods parameters are missing for decompiled Scala classes and as code completion information.

Besides these minor problems IntelliJ IDEA is a wonderful tool to develop Scala with and it does not crash. Go and try it yourself.

14 comments:

  1. I've been following the Scala IDE plugin landscape for quite a while too.

    One thing I read several weeks back regarding the Eclipse/Scala plugin is that its functionality was going to be reduced in the short term (a period we a still currently in) so that a major rewrite could be done to drastically improve things in the long run.

    In other words, while IntelliJ/Scala may be the best combination at the moment, it appears other high quality Scala IDEs may be forthcoming.

    Good news for all of us! :)

    ReplyDelete
  2. Regarding analysis integrated with build tools:

    www.jetbrains.com/teamcity/index.html

    (look at Proactive Quality Verification)

    ReplyDelete
  3. @Donald - Thank you for sharing the link. The "Pre-Tested Commit" (http://www.jetbrains.com/teamcity/delayed_commit.html) feature looks promising. I ought to check it out.

    ReplyDelete
  4. You really should give netbeans another try as I have no problems with their scala plugin and it seems to be more feature complete that eclipse or itellij. If you were using an older netbeans version 6.5 or 6.7 you probably did not get the latest plugin version. I recomend the 6.8 version and the instructions are right here http://wiki.netbeans.org/Scala68v1. Development has stopped for previous versions as far as I know. The current netbeans scala plugin is the release candidate and is feature complete.

    ReplyDelete
  5. The latest version of the Scala plugin for IDEA 9.0 handles implicit conversions.

    Simply invoke code completion again to get matches from implicit conversions.

    ReplyDelete
  6. I have to mostly agree with, IDEA is great for Groovy and Scala developement... also of others... but I have couple of issues under Ubuntu 9.10 (IDEA 9.0) which is little harassing.

    ReplyDelete
  7. The latest version of the Scala plugin for IDEA 9.0 does include completions from implicit conversions - no need to invoke code completion twice as before.

    ReplyDelete
  8. +1 !! Surprising though....

    ReplyDelete
  9. David Pollack says IntelliJ sucks big time! (the fact that Scala support is acceptable is a minor plus compared to the described problems). Or is he talking about a really old version? I'm confused.

    http://blog.lostlake.org/index.php?/archives/91-IntelliJ-update-its-still-a-piece-of-junk-but-Scala-support-isnt-bad.html#extended

    ReplyDelete
  10. As far as I do remember he didn't liked the feel of IDEA per se (like auto save). It's different from Netbeans.

    ReplyDelete
  11. This plugin doesn't work on Windows 7 64-bit, no refactoring support, no equivalents of tools like Checkstyle or PMD. What's more, the new Scala 2.8 is not binary compatible with Scala 2.7.
    It's a pity to say, but unfortunately: Scala is still not production-ready.
    More info: http://coding-masters.blogspot.com/2010/07/scala-not-quite-yet.html

    ReplyDelete
  12. @iirekm

    To late for the flame war: http://codemonkeyism.com/scala-unfit-development

    Yes, Scala versions are not source and binary compatible. Get over it. If this does not fit your neads pick another platform.

    And please pick a correct title: Scala IDEs – can we use them?

    ReplyDelete
  13. Scala IDE for IntelliJ is not much better than the one for Eclipse. It consumes all CPU and memory it can get and hangs frequently. At least with project over 50 files.

    ReplyDelete
  14. I can't speak for netbeans, but IntelliJ beat Eclipse hands down when it comes to Scala support. I just wrote a whole post on Scala tooling as a 1 year recap on a project that now has ~ 20LOC of Scala and > 200 source files:

    http://agile-automata.net/?p=346

    Thomas: Are you using Idea10? I can't speak for previous versions, but 10 is very stable for our medium sized project.

    ReplyDelete