-
Notifications
You must be signed in to change notification settings - Fork 24
Getting Started
This Eclipse plugin allows experimentation with the Scala language in a new way. A worksheet is a Scala file that is evaluated on save, and the result of each expression is shown in a column to the right. Worksheets are like a REPL session on steroids, and enjoy 1st class editor support: completion, hyperlinking, interactive errors-as-you-type, auto-format, etc.
The Worksheet is published in the Scala IDE ecosystem and is installed through the normal Eclipse update mechanism. The worksheet depends on the Scala IDE being installed. Currently we only have nightly builds for the worksheet, and they depend on the Helium nightly.
Point your Eclipse installation to the desired update site and select Scala Worksheet from the list of installable software. Once the plug-in is installed, restart Eclipse.
Create your first worksheet but right-clicking on a Scala project and choosing New Scala Worksheet. Or, if you are a shortcut junkie, hit CMD-3, type Scala worksheet and hit enter when the correct command appears in the quick command window.

Scala worksheets are normal Scala files, but instead of .scala, they end in .sc. An editor is open for the newly created worksheet, and notice that after a few moments a greeting is printed next to the first expression in your object.

You can start typing and notice that most features of the Scala editor are available. Whenever you save, the worksheet is re-evaluated and the results are printed in line with your program.

If the output of a certain line is too long or does not fit on one line, the new lines are introduced as needed. There is a (configurable) maximum number of characters that are placed in the editor. If the program takes too long to execute, the editor adds a spinning line after 2 seconds. You can interrupt the evaluation at any point by typing any character or Esc.

The current project is on the worksheet classpath. You can immediately start experimenting with your code, or dependent libraries. Make sure the project is built and there are no errors (the best is to enable Project/Build automatically).

You can configure how to highlight the results, and the cut-off value on the plug-in configuration page.

Most features of the Scala editor are available in the worksheet editor:
- highlight errors as you type
- code completion (including auto-import)
- hyperlinking
- code format (context menu, or Cmd-Shift-F)
- code hovers