Clone this wiki locally
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 of your program. 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 available for Scala IDE V3.0, and it can be installed in either Eclipse 3.7 (Indigo) or Eclipse 4.2 (Juno).
Other releases, if available, are listed on the Wiki Home Page.
The worksheet stable release depends on the Scala IDE V3.0. So, you should first install the Scala IDE V3.0 and then, via the same update site, install the worksheet plug-in. The worksheet plugin is listed under the Scala IDE plugins group.
Create your first worksheet but right-clicking on a Scala project and choosing New Scala Worksheet. Alternatively, 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, except that theythey end in .sc instead of .scala. An editor is open for the new worksheet; notice how 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, new lines are added 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 bar 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 so you can immediately experiment with your code or its dependent libraries. Make sure the project is built and there are no errors (the best is to enable Project/Build automatically). The worksheet won't force a project build if it is not up to date!
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)
- code format (context menu, or Cmd-Shift-F)
- code hovers