For now Scala plugin for IntelliJ IDEA is in a stage of active development. Its last versions are available for IntelliJ IDEA EAP. So, to start, first let's download last EAP from IntelliJ IDEA EAP page. Also to work Scala we'll need last version of Scala Programming Language distribution, which may be downloaded from Official Scala Site.
First of all we have to download last Scala plugin form plugin repository. The simplest way to do it after IDEA started is to use appropriate button on IDEA welcome screen.
In plugin manager window we choose Scala plugin. One could use search line to simplify this process. Clicking with right mouse button on it, we install it and restart IDEA to apply changes (we have to start it manually after shutdown).
After stratup we can notice that Scala plugin appeared in the list of installed plugins. So, now we are ready to create our first Scala project in IntelliJ IDEA. Click Create New Project on Welcome page. Choose Create project from scratch. Let first module will be Java Module.
In the list of desired technologies mark Scala checkbox and click to button with points to adjust our Scala SDK for compilation and using Scala libraries. Here we should point to installation directory of Scala programming language as follows.
Click finish and IDEA asks, what type of library we want to create - Application-level or Project level one? Main difference is that project library settings will be saved in project file, which may be useful to share same settings between several developers. Application-level library will be visible to attach for all projects on current machine.
Note: In near-term future we're going to make configuration process more flexible to not gather all scala-related jars in all library. It's crucial moment for projects like liftweb applications, which being inported from Maven repository may contain Scala jars separated by various libraries.
So, we just adjusted all necessary details to start writing our HelloWorld application. To create it right-click (or press Alt-Ins in defaul Windows IDEA keymap) on src folder and choose Scala Object.
Type name of our object, namely "HelloWorld" in a name dialog, and here is our first Scala object. There are several ways to make it runnable. The simplest one is to inherit it form defauls scala.Application trait and put all appropriate logic to its body. We don't have to type all "Application" name. Just type several first letters and press Ctrl-Space. Class name completion will do all remaining work for us.
Another, more java like way is to create well-known main() method inside of object body. To simplify this and several others copmmon operations Scala plugin for IntelliJ IDEA provides useful live templates. For instance, to create new well-formed main() maethod just type main and press Tab.
Now we can put somethind to our main method body and run application. Users already familiar with IDEA know, that to run simple application it's enough just press Ctrl-Shift-F10 (in Windows keymap). We're able to act the same way in Scala. Notice, that now our HelloWorld object is marked with green triangle in Project view, which means, that it can be run immediately as plain Java application. Another way to run it is to create Run configuration manually and choose Application type.
Our first acquaintance with Scala plugin for IntelliJ IDEA draw to a close, but don't forget to read about and try to use other features, such as Java/Scala cross-language interoperation, refactorings, smart editor actions and many others!