Real FSC support
Usual Scala compilation never seems fast enough. There are two main reasons why:
- It takes a lot of time to start Scala compiler and to process standard libraries.
- Scala compiler doesn’t support selective recompilation.
The first problem is solved by FSC (Fast Scala Compiler). FSC runs a compilation daemon to avoid subsequent compiler instantiations (at the price of increased memory usage).
However, FSC still re-compiles everything you throw at it (usually – the whole project, even if you’ve changed a single file). To speed up compilation further, we need to use a selective recompilation, that is provided only by third-party tools (like SBT or IDE).
So, the combination of IDEA and FSC can provide lightning-fast Scala compilation.
Scala plugin has been supporting FSC for a long time. Kind of… It was hard to configure and use FSC, settings was vague and compilation daemon was … you know, uncontrollable. Now that things have changed.
We can setup either internal FSC server (per project) or external (possibly remote) one:
Then we may use that server in any module we want:
So we can mix FSC with ordinary Scala compilers (when there are multiple versions of Scala used or when we need special compilation settings for some modules).
IDEA automatically manages internal FSC servers – it starts an instance when needed and stops it on application exit (or project close). Additionally, we can manually start, stop or reset compilation daemon using a menu on FSC status icon:
Besides FSC status icon (a little gear-gauge in the status bar) we are receiving notifications on FSC events:
P. S. Mac users may need to configure the OS X firewall for FSC communication.