views:

778

answers:

7

Hi SO members,

What Tools do you people use to work with Scala? For my learning phase, I used the Scala REPL and hacked some code with TextMate and compiled it with the scalac CLI. But as the projects grow in size, much more sophisticated tools are required.

I am aware of the Scala plugins for Elipse, IntelliJ and Netbeans and I tried them all. The best one is IMHO IntelliJ, but still far away from being perfect.

The major issue I have is the lack of auto completion. As a not-so-advanced Scala coder, I still dont know the whole standard API and have to switch between the Scaladoc and IDE regularly. This feels like "killing productivity". But they all fail to auto-complete method arguments. (I heard that method arguments are not included in compiled scala code, but what about attaching source to do auto completion?)

Another very annoying issue is the build process. I am using Maven to build my Scala projects and manage their dependencies. But nevertheless, I have to do a full rebuild to test my changes. Maybe I am spoiled by Eclipses incremental rebuild available in the Java world, but it feels like a big issue to me.

I like Scala very much and I feel way more productive while coding, but the lack of sophisticed tools let me feel less productive. And both seem to cancel out themselves.

So, whats my question? I doubt every single Scala programmer uses good ol' vim or emacs along with scalac to do their work. So what tools do you use? What workflows have you developed to bring speed into developing with the Scala language?

Edit

Clarification what I ment with auto-completion of method arguments.

val myList = "foo" :: "all your base" :: Nil
myList.partition(_.length > 3)

For the code above, IntelliJ fail to provide me with the information that partition requires that I have to pass a () => Boolean function. In fact, IntelliJ does not check for this contraint. I can pass a String and IntelliJ will not indicate my error until I do a compile.

+4  A: 

One simple way is to use fsc, an offline compiler. It maintains caches of information, and the standard compiler will talk to fsc (running as a daemon) and use its cached information during compilation, thus speeding up your compilation cycle.

Brian Agnew
+11  A: 

scalac

Get familiar with command line options to Scalac.

  • -deprecation
  • -Xprint:all: watch your code progress through compiler phases, very useful to see what implicits are applied.
  • -help / -X' /-Y` list all options.

The latest nightly builds of scalac include a bash completion file that makes these easier to use.

IntelliJ IDEA

Method completion with Javadoc (CTRL-Space, CTRL-Q/Apple-J) Screenshot

Parameter Info for the example in the question (CTRL-P) Screenshot

Method Argument Completion (CTRL-SHIFT-Space). Screenshot

You need to have the source or javadocs linked into the dependencies in IntelliJ to see the Javadoc.

It doesn't currently highlight type errors on the fly, as there are still too many false-positives in complex code. This is coming, though.

Simple Build Tool

SBT keeps the compiler resident, and analyzes dependencies between classes to allow incremental recompilation. It can also monitor for changes to source files and automatically trigger recompilation and/or test execution.

  • Continous Compilation: >~compile
  • Continuous Compilation + Test: ~test-quick

I have SBT and IntelliJ project configured in http://github.com/scalaz/scalaz, you could use this as a reference.

retronym
Which version of the IntelliJ Plugin do you use?
Malax
+1 IntelliJ (code completion/IDE) + SBT (building) is easily the best toolset available for Scala.
Michael
I'm using Scala 2.8 with a nightly build from of the plugin http://confluence.jetbrains.net/display/SCA/Scala+Plugin+Nightly+Builds. They aren't always perfect -- there are some big refactorings happening at the moment.
retronym
Accepted this answer because: SBT rocks (Didn't use it before, very awesome tool) and providing me with information about to get my lovely method argument completion from IntelliJ. Nevertheless, I upvoted all the other IHMO helpful answers.
Malax
Sorry to bother again... I can't get the auto-competion working. :-/ Maybe I can get a litte hint where to look? Linking to Scaladoc does not seem to work and IntelliJ calls it Javadoc everywhere... *sigh*
Malax
+5  A: 

I've been using Scala daily for the last six months. I'm still using vim (and ctags to find stuff), and Maven for builds. I've gotten some good mileage out of JRebel when working on Lift web apps -- it will reload changes on the fly without server restarts.

I spent some time looking into IDEs, but it got depressing really fast. I really missed a lot of Eclipse features at first, but after a period of adjustment I don't think I'm significantly less productive now.

I've heard some rumblings that NetBeans is the current champ for Scala IDEs, but I haven't tried it first hand.

overthink
+2  A: 

I am afraid you have to wait for Scala to become rock-solid. I had exactly the same issue with Java ten years ago. It was even worse.

I also tried them all. For Scala 2.7.7 IntelliJ is the winner, but for Scala 2.8.0-SNAPSHOT Eclipse is not that bad. Wait half of a year after 2.8.0 is released and check again. It should become bearable.

Gene T
+2  A: 

With Scala 2.8, please see this for getting better performance out of Maven.

Daniel
+1  A: 

Here's my answer on a similar thread. After giving about an hour to Ensime. I just can't help but get the word out. I must say it's very very well written for an Emacs package.

Y.H Wong
+1  A: 

You should also give Netbeans 6.8 a try with the nightly Scala build. I am very satisfied programming Scala with this IDE. For building, I sometimes also use Ant. The best thing about NB Scala plugin is that it is fast and code-completion works flawlessly.

For the example you gave: NB gives me this error

alt text

code-completion:

alt text

Jus12