Metals extension for Visual Studio Code
Metals is still in early development so you may run into rough edges. The following table shows the status of various features.
Java 8 or 11 provided by OpenJDK or Oracle. Eclipse OpenJ9 is not supported,
please make sure the
macOS, Linux or Windows. Metals is developed on macOS and every PR is tested on Ubuntu+Windows.
Scala 2.13, 2.12 and 2.11. Metals supports these Scala versions 2.13.0, 2.12.8, 2.12.7 and 2.11.12. Note that 2.11.x support is deprecated and it will be removed in future releases. It's recommended to upgrade to Scala 2.12 or Scala 2.13
Install the Metals extension from the Marketplace.
Next, open a directory containing a
Importing a build
The first time you open Metals in a new workspace it prompts you to import the build. Click "Import build" to start the installation step.
Once the import step completes, compilation starts for your open
Once the sources have compiled successfully, you can navigate the codebase with goto definition.
Custom sbt launcher
By default, Metals runs an embedded
Update the "Sbt Script" setting to use a custom
Speeding up import
The "Import build" step can take a long time, especially the first time you run it in a new build. The exact time depends on the complexity of the build and if library dependencies need to be downloaded. For example, this step can take everything from 10 seconds in small cached builds up to 10-15 minutes in large uncached builds.
Consult the Bloop documentation to learn how to speed up build import.
When you change
Manually trigger build import
To manually trigger a build import, execute the "Import build" command through
the command palette (
Execute the "Run Doctor" through the command palette to troubleshoot potential configuration problems in your workspace.
Configure Java version
The VS Code plugin uses by default the
To override the default Java home location, update the "Java Home" variable to in the settings menu.
If this setting is defined, the VS Code plugin uses the custom path instead of
To globally configure
If you prefer to manually configure Java home through VS Code, run the following command to copy the Java 8 home path.
Custom artifact repositories (Maven or Ivy resolvers)
Use the 'Custom Repositories' setting for the Metals VS Code extension to tell Coursier to try to download Metals artifacts from your private artifact repository.
Metals uses Coursier to download
artifacts from Maven Central. To use Metals behind an HTTP proxy, configure the
Using latest Metals SNAPSHOT
Update the "Server Version" setting to try out the latest pending Metals features.
See https://scalameta.org/metals/docs/editors/vscode.html#using-latest-metals-snapshot to find the latest SNAPSHOT version.
Run the "Reload Window" command after updating the setting for the new version to take effect.
|Go to class||Go to symbol in workspace|
|Parameter info||Trigger parameter hints|
|Basic completion||Trigger suggest|
|Type info||Show hover|
|Extend Selection||Expand selection|