Interactive Scala is an extension for Visual Studio Code. This extension lets you select Scala code and execute it in the Scala interpreter REPL by a quick keyboard shortcut.
Requires Scala Syntax (official) extension.
The extension will automatically open a new integrated terminal and initialise the Scala interpreter upon opening a
Once in a
.scala file, you can select a subset of your Scala code and use the keyboard shortcut
alt+enter to quickly execute the code in the Scala interpreter or
ctrl+alt+enter to execute a whole file at once.
ctrl+alt+r allows you to reset Interactive Scala and start from scratch.
The shortcuts can be changed in your VS Code settings.
If you are to send single line to the interpreter, there's no need for selection at all! Just place the caret on the line and press the shortcut.
Shortcuts are not your style? You can now use the context menu as well! Just select some code and right click to send it to the interpreter.
The used REPL Scala interpreter can be changed through the VS Code preferences. You can choose any Scala interpreter you like, including
scala (default) and
The first of which is using the system-wide Scala installation through the
sbt console uses the Scala Build Tool thourgh the
sbt command and will use the local project installation. Please note, that SBT will instantiate a new project, if none is found in the working directory.
sbt console is a bit slower initially, as SBT will compile and check for updates before entering the interpreter.
Different requirements are applicable for the interpreter options.
If you are using the system-wide Scala installation, you must have installed the Scala binaries and added the
scala command to PATH.
If you are using the project installation, you must have SBT installed. You should also have a Scala project in your working directory, otherise SBT will automatically instantiate it when you are using this extension.
The default shell for the integrated terminal on Windows (PowerShell) is known to cause problems with manual input to the Scala interpreter.
Change the shell to e.g. Git Bash as a workaround.
- Now requires Scala Syntax (official) extension.
- Fixed that the shortcuts were available outside Scala files.
- Execute a whole file by opening it in the editor and press
ctrl+alt+enter or by selecting it from the context menu in the file.
- Reset Interactive Scala by pressing
ctrl+alt+r or by selecting it from the context menu in the file.
- Free choice of the interpreter, you are no longer limited to
- The cursor now moves to the next line when you execute a single line.
- The focus is now maintained on the selected code instead of transferring focus to the terminal when executing code.
- Setting to require jar-files upon initialisation of the REPL.
- The input is now wrapped in
Ctrl+D to support bigger code pieces better.
- The terminal now shows itself when code is sent to the terminal.
- The Interactive Scala terminal can be reopened by using the shortcut on some Scala code.
- Option to change interpreter to SBT through VS Code configuration. Default is Scala system binaries.
- Context menu option. Select some text, right click and click "Execute selected code in Interactive Scala".
- Single-line execution. Place the caret on a code line and execute it without selecting any text.
First stable version.
- Automatic opening of Scala interpreter.
- Shortcut to execute Scala code in interpreter.