IntelliJ IDEA 2017.2 Help

Working with Scala Worksheet

The following is only valid when Scala Plugin is installed and enabled!

IntelliJ IDEA lets you create a Scala worksheet that enables you to evaluate your Scala code results in a special view of the Scala editor.

Creating Scala Worksheet

  1. Right-click on your project and select New|Scala Worksheet.
    create sc worksheet

    It is recommended to create your worksheet in src directory to simplify an inclusion of the project's classes in the classpath. That might be helpful for testing purposes.

  2. In the New Scala Worksheet window type a name of your Scala worksheet and click OK.

    As a result, a file with .sc extension opens. Now you can enter your code.

    sc worksheet

Running Scala Worksheet

  1. Enter your code and press run to see the results. If you select Interactive Mode check box then the code results will be displayed automatically.

    You can clear the Make project check box to improve evaluation performance. In this case, the automatic checking of project's changes is disabled. The results appear in the view on the right side of your code.

  2. You can evaluate a Scala object.
    sc wsheet fold
    You can fold the output without affecting your code on the left side and expand only that block output that matches a specific statement.
    sc wsheet unfold

Removing Worksheet's Results

  • Remove the worksheet's results easily by pressing sc remove ws icon icon.

Copying Actions

  • Copy your code and evaluation results into one file by clicking copy icon.
    sc copy results

Configuring Worksheet Settings

  1. Select File|Settings|Languages and Frameworks|Scala and click Worksheet tab.
  2. On the Worksheet tab, you can set the output cutoff limit and configure in what mode you want to run the worksheet.
    sc worksheet settings
Last modified: 29 November 2017

See Also