Skip to main content

Metals v0.7.0 - Thorium

· 7 min read

We are excited to announce the release of Metals v0.7.0 - codename "Thorium" 🎉 The release includes several new features along with bug fixes.

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

In this release we merged 21 PRs and closed 8 issues, full details: https://github.com/scalameta/metals/milestone/11?closed=1

TL;DR

  • New tree view in VS Code
  • New support for Scala 2.13
  • New support for JDK 11
  • New improved classpath indexing performance
  • New fallback to "find references" when calling "goto definition" on a symbol definition
  • Bug fixes for importing builds in Gradle, Mill and sbt
  • Dropped support for deprecated Scala versions 2.11.9, 2.11.10, 2.11.11, 2.12.4, 2.12.5 and 2.12.6.

Check out the website and give Metals a try: https://scalameta.org/metals/

Tree views in VS Code

There is now a new "Metals" sidebar in VS Code that contains three tree views:

  • Build: overview of the build state, with buttons to manually trigger build import.
  • Compile: overview of ongoing compilations, with buttons to manually cascade compilation and cancel ongoing compilation.
  • Help and feedback: buttons to automate troubleshooting Metals issues and links to relevant online resources such as GitHub, Gitter and Twitter.

Projects explorer

2019-06-26 20 28 14

Libraries explorer

Browse symbols that are defined in jars of library dependencies.

2019-06-26 20 28 51

Reveal active file in Metals side bar

There is a new command "Reveal active file in Metals side bar" that focuses the library and project explorer to the current open file.

2019-06-27 16 02 33

Compilation explorer

Get an overview of all compilations that are ongoing in the build. Previously, only a single compilation progress was reported through the status bar.

2019-06-23 15 41 07

Help and feedback explorer

Screenshot 2019-06-27 at 15 57 15

Support for Scala 2.13

Metals now supports Scala 2.13.0! Please upgrade to Scalafmt v2.0.0 in order to format 2.13-specific syntax such as underscore separators (1_000_000). Note that completions may in rare situations not work perfectly for Scala 2.13, in particular:

  • whitebox string interpolator macros, we had to disable one unit test for 2.13. See #777.
  • better-monadic-for compile plugin, we had to disable one unit test for 2.13. See #777.

Big thanks to @gabro for leading this effort!

JDK 11 support

Metals can now run on Java 11! To use Java 11 instead of Java 8, point the $JAVA_HOME environment variable to a Java 11 installation.

The VS Code extension will continue to use Java 8 by default, update the "Java Home" setting to use Java 11 instead.

To obtain the Java 11 home on macOS, use the following command:

$ /usr/libexec/java_home 11
/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home

Big thanks to @er1c for pushing for the effort on both the Bloop and Metals side to support Java 11!

Improved classpath indexing performance

Previously, to support fuzzy symbol search Metals indexed classpath elements using an algorithm that required a quadratic iteration on the number of characters in classfile names. Now, the fuzzy symbol search algorithm only requires a linear pass on the characters of a classfile name. This optimization resulted in a 2x speedup for indexing a 235Mb classpath in our benchmarks.

  Benchmark                   Mode  Cnt     Score    Error  Units
- ClasspathIndexingBench.run ss 10 1809.068 ± 61.461 ms/op # JDK 8
+ ClasspathIndexingBench.run ss 10 919.237 ± 42.827 ms/op # JDK 8
+ ClasspathIndexingBench.run ss 10 1316.451 ± 22.595 ms/op # JDK 11

Fallback to "find references" from "goto definition"

Previously, nothing happened when invoking "goto definition" on the symbol definition itself. Now, Metals falls back to "find references" in this situation.

Fallback

Big thanks to @tanishiking for contributing this new feature!

Dropping older Scala versions

The Scala versions supported by Metals are now the following.

VersionOld StatusNew Status
2.11.9DeprecatedDropped
2.11.10DeprecatedDropped
2.11.11DeprecatedDropped
2.11.12SupportedDeprecated, with no plans to be dropped in upcoming releases*
2.12.4DeprecatedDropped
2.12.5DeprecatedDropped
2.12.6DeprecatedDropped
2.12.7SupportedDeprecated, please upgrade to 2.12.8
2.12.8SupportedSupported
2.13.0UnsupportedSupported

* Scala 2.11 support will likely stay around for a while given the situation with Spark, Scala Native, Playframework and other libraries and frameworks that have been late to adopt 2.12. Our download numbers show that ~10% of Metals users are still on 2.11. Nevertheless, we encourage our users to upgrade to 2.12 to enjoy a better code editing experience thanks to multiple improvements in the compiler.

Fixes for auto importing builds

  • digest only .sbt files at workspace level for sbt projects (thanks @wojciechUrbanski!)
  • fix SemanticDB plugin path on Windows for Gradle workspaces
  • update default Mill version to 0.4.1 to fix an issue with classpath not containing Scala library
  • Metals now pick up the version from .mill-version for the millw script

No more "work in progress"

Previously, the Metals website used the "Work-in-progress language server for Scala" tagline to reflect the experimental status of the project. Now, the tagline on the website has been changed to "Scala language server with rich IDE features" to reflect that Metals is used by thousands of developers today for their day-to-day coding.

Miscellaneous fixes

  • fix off-by-one for parameter hints when the cursor was after the closing ) parenthesis
  • make sure we add an autoimport in the correct line in case of brackets
  • document symbol outline no longer fails when val _ = () is the only thing in a block expression
  • nested objects are now imported correctly in case of deeper nesting
  • fix concurrent modification in text document cache (thanks @chikei!)

Contributors

Big thanks to everybody who contributed to this release, it's amazing we had a couple of new contributors to Metals!

$ git shortlog -sn --no-merges v0.6.1..v0.7.0
Gabriele Petronella
Ólafur Páll Geirsson
Tomasz Godzik
Eric Peters
tanishiking
Ruben Berenguel
TzeKei Lee
Wojciech Urbanski

Merged PRs

v0.7.0 (2019-06-28)

Full Changelog

Merged pull requests:

  • Upgrade to Scalameta v4.2.0 #799 (olafurpg)
  • Introduce Tree View Protocol #797 (olafurpg)
  • Add a benchmark for classpath indexing performance. #795 (olafurpg)
  • Migrate Java converters to 2.13 #794 (gabro)
  • Remove dot as a commit character #793 (tgodzik)
  • Make classpath indexing linear instead of quadratic. #792 (olafurpg)
  • Use 2.13 dialect for syntax errors #789 (gabro)
  • Fix off-by-one for parameter hints. #786 (olafurpg)
  • Make sure we add an autoimport in the correct line #785 (tgodzik)
  • Fix typo #784 (tanishiking)
  • Remove Work-in-progress from the tagline #782 (gabro)
  • Fix JdkSources not to ignore JAVA_HOME environment variable #781 (tanishiking)
  • Fix importing nested objects #778 (tgodzik)
  • Fix an issue when val \_ = \(\) is the only thing in the block #776 (tgodzik)
  • Fallback to "show usages" from "Goto definition" if the symbol represents a definition itself #775 (tanishiking)
  • Move slow tests to separate directories and run them separately on Travis #773 (tgodzik)
  • Digest only sbt files at workspace level #772 (wojciechUrbanski)
  • Fix wrong windows SemanticDB file path #771 (tgodzik)
  • Fix concurrent modification #766 (chikei)
  • Factor out a ClasspathLoader.getURLs(classLoader) helper for java9+ compatability, update usages #765 (er1c)
  • Include mill version from .mill-version file #764 (tgodzik)
  • Add 2.13 support and drop deprecated versions #763 (gabro)
  • Clarifiyng a setting #759 (rberenguel)
  • Fix very small typo in docs #758 (rberenguel)
  • Fix completions to compilation in blog #757 (tgodzik)
  • Update VS Code docs #756 (tgodzik)
  • Add release notes for Metals Radium release #752 (tgodzik)