I entered Scala courses on Coursera and used to write Scala projects in Eclipse Indigo
. All worked well. But now I gonna to convert to my favorite IDE - Intellij IDEA.
But I can't configure it for Scala usage.
What I've already done:
SCALA_HOME
variableWhat a problem:
When I import coursera assignments, Intellij doesn't see some classes like List
, Array
etc. For example, when I try to import it via Alt+Enter
key it propose me java.jang.reflect.Array
, java.sql.Array
, com.sun.xml....Array
. So I can't import Scala Array with tail
and head
methods.
When I try: New Project
-> Scala Module
the are to problems:
a) When I choose Set Scala Home
it complains that there are missing files
b) When I choose Existent Library
there is nothing to choose in Compiler
/Standart
fields.
Question:
How to configure Intellij properly?
To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA.
In most cases your project JDK is not compatible with Scala or sbt version, try to change the Scala Compile Server SDK. Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.
To add Scala support to existing module:Right-click the module in Project View, choose “Add Framework Support…” Check “Scala” in technologies list (unavailable if module has Scala facet attached) Provide a path to Scala installation (if not detected)
1 Create or import a Scala project as you would normally create or import any other project in IntelliJ IDEA. 2 Open your application in the editor. 3 Press Shift+F10 to execute the application. Alternatively, in the left gutter of the editor, click the icon and select Run 'name'.
Also IntelliJ IDEA lets you keep track of error analysis based on the Scala type system using the Scala type-aware highlighting. By default, it is enabled and you can see the icon located at the bottom of the user interface.
IntelliJ IDEA can select more than one piece of code at a time. You can select next occurrence via Alt+J and deselect by pressing Alt+Shift+J. You can even select all occurrences at once, by pressing Ctrl+Alt+Shift+J. For more details, refer to Editor basics.
The Use UI with sbt option that displays the test results in the same format as for platform test runner is not available. IntelliJ IDEA lets you test scopes using ScalaTest or Specs2. You can run tests inside a scope or test the whole scope in your Scala projects.
It can be a problem with caches, try File -> Invalidate Caches
Is the directory you specified the right one? It should have bin, doc, etc. in it. If so, try entering the following by hand:
For compiler library, scala-compiler
For standard library, scala-library
IDEA found these for me automatically, but perhaps something went wrong for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With