Published 2024-07-18.
Time to read: 2 minutes.
Visual Studio Code is a free, very capable, and well-designed IDE. Although its refactoring capabilities are weak, it works very well on all platforms, including Windows Subsystem for Linux (WSL).
Scala support for Visual Studio Code has the following limitations. IntelliJ IDEA does not have these limitations, and it is very good at refactoring code.
- Scala 2.11.x support is deprecated; it will be removed in future releases. Older versions of Scala are not supported.
- JDKs older than v11 are not supported. If no compatible version of Java is found, a compatible JDK will automatically be downloaded.
-
Traditionally, Scala worksheets had
.sc
filetypes. VS Code requires a.worksheet.sc
filetype.
Setup
- Install Visual Studio Code and run it.
- Click on the extensions view icon on the left.
- Type
@popular scala
into the text field at the top of the extensions view. - Uninstall these extensions if they are present – these old extensions are no longer available: Uninstall these extensions because they are no longer needed:
- Install these extensions for Scala: You do not need to install any other VS Code extensions for running Scala; Metals does that.
- Are these extensions useful?
In a VSCode project, the file
.vscode/extensions.json
contains the recommended list of extensions.
Following are the contents of .vscode/extensions.json
that I use for this course’s GitHub projects.
You might want to use a similar file for your VSCode Scala projects.
{ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp // List of extensions which should be recommended for users of this workspace. "recommendations": [ "scala-lang.scala", "scalameta.metals", "vscjava.vscode-java-pack", "devonray.snippet", "timonwong.shellcheck", ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [ "dragos.scala-lsp", "lightbend.vscode-sbt-scala", "lampepfl.dotty-syntax", "itryapitsin.Sbt" ] }
Metals
The Metals documentation for VS Code is pretty good.
© Copyright 1994-2024 Michael Slinn. All rights reserved.
If you would like to request to use this copyright-protected work in any manner,
please send an email.
This website was made using Jekyll and Mike Slinn’s Jekyll Plugins.