Scala in IntelliJ IDE

IntelliJ IDEA lets you run Scala Console to quickly evaluate an expression or a code selection.

NOTE the differences from using Scala SDK terminal:

  • If you want the console to execute when you hit enter, go to Preferences > Keymap > Plug-ins > Scala, and right-click ScalaConsole.Execute. Select Add Bookmark and hit enter in the first box. Then click Apply and then OKenter image description here
  • This behavior is controlled by the following code style setting (Blank Lines | Around Method):
  • around method

 

1.Run Scala Console

Right-click on your Scala object and select Run Scala Console from the drop-down list.

The Scala Conslole window opens.

2.Evaluate Code in Scala Console

You can type an expression in the console and evaluate it. You can also evaluate a code selection by sending it from the editor to the Scala console.

To see the result of the typed expression, press Ctrl+ Enter.


To send the code selection to Scala Console, select the code in the editor, press Ctrl+ Shift+ X (for Windows) or Meta+ Shift+ X (for Mac).
Alternatively, right-click on the code selection and from the context menu select Send Selection To Scala Console to get the same result.

Now, you can view the selected code and its evaluation in the console.

admin has written 51 articles