Skip to main content

Metals v0.9.4 - Lithium

· 6 min read

We're happy to announce the release of Metals v0.9.4, which focuses on improvements in Scala 3 worksheets, a couple of new features, and a number of smaller improvements.

Commits since last release115
Merged PRs50
Contributors6
Closed issues15
New features2

For full details: https://github.com/scalameta/metals/milestone/27?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!

  • Scala 0.26.0 and 0.27.0-RC1 support.
  • Analyze stacktrace command
  • Customizable package exclusions

Analyze stacktrace command

Thanks to kpbochenek, Metals can now help with navigating stack traces using the new metals.analyze-stacktrace command. The only thing it needs is the actual stack trace string to be input as a parameter to the command. This new functionality works differently in various editors.

Visual Studio Code

The only thing users need to do is copy the stack trace and run the Analyze Stacktrace command from the command palette. This will display a new web view, where it will be possible for users to navigate the files that are included in the exception.

stacktrace-vscode

coc-metals

With coc-metals, you just need to copy the stacktrace, whether from sbt, bloop-cli, or somewhere else into your register. Once you have it copied, you can just execute the metals.analyze-stacktracecommand. This will create a.metals/stracktrace.scala file which can be used to navigate through your stacktrace using code lenses. Keep in mind that you'll want to make sure you have codeLens.enable set to true in your configuration. Also, since this feature relies on code lenses (virtual text in Nvim), it's only supported in Nvim.

stacktrace-nvim

Other editors

To make it work with any other editors users need to run the command manually with the stacktrace as input, similar to the example above with coc-metals. The command will generate a new file, .metals/stacktrace.scala, which can be used to navigate through the stacktrace using code lenses.

Customizable package exclusions

Usually, a number of packages are almost never used by the developers and could clutter the language server output while being of little benefit to the users. Metals would exclude those packages from indexing causing them to not be recommended for completions, symbol searches, and code actions. Previously that list was set in stone and consisted of a number of prefixes:

val defaultExclusions: List[String] = List(
"META-INF/", "images/", "toolbarButtonGraphics/", "jdk/", "sun/", "javax/",
"oracle/", "java/awt/desktop/", "org/jcp/", "org/omg/", "org/graalvm/",
"com/oracle/", "com/sun/", "com/apple/", "apple/"
)

This list might work in most cases, but users might also want to customize the list according to their preferences and domain they are working on. Starting with this release it is now possible to define additional exclusions as well as remove some from the default list. This can be done via an additional Metals user setting:

"metals.excluded-packages" : [
"akka.actor.typed.javadsl", "--javax"
]

-- should only be used to remove some of the defaults if they aren't needed for your project. Thanks to ckipp01 for contributing this feature!

Miscellaneous

Some of the smaller improvements to Metals include:

  • New recommended Maven Scala template.
  • Fix go to source and auto imports in standalone worksheet files.
  • Fix missing classes from _empty package in tree view.
  • Add a command to quickly create a new worksheet with a default name.

Beside all the core work on the server itself, there have also been a lot of great work done in various other Scalameta projects, which Metals relies on. These projects include mdoc, which powers worksheets and Scalameta, which powers all SemanticDB and parsing powered features. Those contributions helped to unlock and improve Dotty support in Metals. So special thanks to those projects and contributors.

Contributors

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

$ git shortlog -sn --no-merges v0.9.3..v0.9.4
Scala Steward
Chris Kipp
Tomasz Godzik
Krzysztof Bochenek
Ethan Atkins
Joseph Price

Merged PRs

v0.9.4 (2020-09-21)

Full Changelog

Merged pull requests: