Skip to main content

Metals v0.9.3 - Lithium

· 6 min read

We're happy to announce the release of Metals v0.9.3, which adds a couple of useful new features as well as support for Scala 0.25.0 and 0.26.0-RC1.

Commits since last release123
Merged PRs59
Contributors9
Closed issues31
New features3

For full details: https://github.com/scalameta/metals/milestone/26?closed=1

Metals is a language server for Scala that works with VS Code, Vim, Emacs, Sublime Text, Atom and Eclipse. Metals is developed at the Scala Center and VirtusLab with the help from Lunatech along with contributors from the community.

TL;DR

Check out https://scalameta.org/metals/, and give Metals a try!

  • sbt script support with hover, completions and go to definition.
  • Scala 3 worksheet support
  • Scala 0.25.0 and 0.26.0-RC1 support.
  • Main classes from dependencies can now be run

sbt script support

Thanks to the great work by dos65 Metals now supports sbt script files as well as build's Scala files. The full list of currently supported features is available here.

sbt support is is achieved by generating additional metals.sbt file for each level of sbt's project. For build.sbt we now generate project/project/metals.sbt, for project/other.sbt project/project/project/metals.sbt etc. This is needed for the Bloop plugin to properly generate information in the .bloop configuration files. It's recommended to gitignore metals.sbt and .bloop anywhere in the file tree.

Scala 3 worksheet support

Finally, it is now possible to run worksheets for Scala 3 starting with version 0.26.0-RC1. To try it out users need to create the worksheet inside of a Scala 3 source directory and then they can be used the same way as with previously supported worksheets.

This is a great place for anyone to experiment with Scala 3 and see what is coming around the corner!

worksheet-sample

Running main classes from dependencies

Previously, users could only run main classes that are defined in the sourcecode, which made it impossible to run and debug in certain frameworks such as the Play Framework. Metals now searches the classpath additionally to find any classes that are defined by the user and not available in the main sources.

To run any such class a full name needs to be provided via the configuration.

For example in Visual Studio Code this would look like this:

{
"version": "0.2.0",
"configurations": [
{
"type": "scala",
"request": "launch",
"name": "Play main",
"mainClass": "play.core.server.ProdServerStart",
"buildTarget": "root",
"args": [],
"jvmOptions": []
}
]
}

In other editors users need to provide the same parameters for the run configuration.

Miscellaneous

  • Removed breakpoints are no longer hit.
  • Compilation is invoked only once for any change.
  • Worksheets now display types next to the code.
  • Fixed wrong completions in string interpolation.
  • Bloop now copies old artifacts by default even if the workspace does not compile.
  • Fixed duplicate code actions in case of range selection.
  • Fixed metals.enableStripMargin option to work without restarting the workspace.
  • Signature help now also triggers when typing ,

Contributors

Big thanks to everybody who contributed to this release or reported an issue!

$ git shortlog -sn --no-merges v0.9.2..v0.9.3
Tomasz Godzik
Scala Steward
Chris Kipp
Cheng Lian
Vadim Chelyshov
Adrien Piquerez
Ayoub Benali
Krzysztof Bochenek
Olafur Pall Geirsson

Merged PRs

v0.9.3 (2020-08-19)

Full Changelog

Merged pull requests: