Skip to main content

Metals v0.4.0 - Tin

We are excited to announce the release of Metals v0.4, codename "Tin" 🎉 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 with contributors from the community.

Metals server#

In this release we merged 50 PRs and closed 21 issues, full details:

Upgraded Bloop#

This release upgrades from Bloop v1.1.2 to v1.2.5, which includes several improvements to diagnostics and compilation performance. See release notes for more details and upgrade guide.

Major props to @jvican for his great work on Bloop. Bloop does the heavy lifting around build import and compilation for Metals.

Syntax errors as you type#

Previously, Metals only published compile errors from the build on file save. Now, a syntax error is also published as you type making it easier to catch common errors like unclosed string literals and missing parentheses.

Syntax errors as you type

This change has an additional benefit in editors like Vim where compile errors would previously disappear if you for example inserted a newline above an error. Now, Metals updates the positions of errors as you type.

Faster and more reliable clearing of fixed compile errors#

A bug where red squiggles for fixed errors would occasionally not be cleared has now been fixed.

Also red squiggles for fixed errors disappear faster thanks to an improvement in Bloop. Previously, diagnostics were cleared after the bytecode generation phase in the compiler and now they are cleared after the typer phase.

More detailed compilation progress#

The status bar now includes information which individual build targets are being compiled along with a percentage estimate for how much remains of the compilation.

Detailed compile progress

Cascade compile command#

Use the new "Cascade compile" command to trigger compilation in downstream build targets in the workspace. For example, if you have made changes in the main sources of you project you can run cascade compile to trigger compilation in the test sources.

Cascade compile

Formatting with Scalafmt#

It's now possible to format code with Scalafmt.

Formatting with scalafmt

It's possible to use different version of Scalafmt between different workspaces. To configure which Scalafmt version to use for a given workspace update the version setting in .scalafmt.conf.

# .scalafmt.conf
version = "1.5.1"

Symbol outline#

It's now possible to browse the symbol outline of a source file.

Document Symbols

Metals returns a hierarchical outline for editor that support it (like Visual Studio Code, Atom, Emacs) and otherwise returns a flat outline.

Find symbol references#

It's now possible to look up all usages of a given symbol in the workspace.

Find symbol references

Fuzzy symbol search#

It's now possible to look up a symbol definition in the workspace or library dependencies by typing its name. All-lowercase queries are treated as case-insensitive searches.

Fuzzy symbol search example

This feature is not supported yet in Sublime Text.

Blog post on low-memory symbol indexing with Bloom filters#

Read the post "Low-memory symbol indexing with bloom filters" to learn how Metals implements indexing for the features "fuzzy symbol search" and "find symbol references".

Visual Studio Code#

Full changelog:

Lower default memory settings#

The extension now starts Metals with the JVM option -Xms100M instead of -Xms1G. The exact memory usage of Metals depends on the size of the project and whether Bloop is installed on the computer or not, but only 50-100Mb can be sufficient memory for Metals in many cases.

Improved Java home detection#

The extension now chooses the latest available JDK home for Java 8. Previously, the extension sometimes picked the JRE over JDK or an older version of Java 8 when newer security updates were installed on the computer.

.jvmopts detection#

The extension now uses JVM options from .jvmopts when launching Metals so it's possible to configure HTTP proxy settings without custom configuration. Memory options like -Xms100M are ignored in .jvmopts, use the "Server Properties" setting to customize memory settings.


It's recommended to update vim-lsc to the latest version, full changelog:

Update log_level setting#

A recent change in how log messages are displayed makes the status bar updates from Metals disappear unless you set the default log_level setting to Log. Update .vimrc as follows:

let g:lsc_server_commands = {
- \ 'scala': 'metals-vim'
+ \ 'scala': {
+ \ 'command': 'metals-vim',
+ \ 'log_level': 'Log'
+ \ }
+ \}

View multi-line error messages#

Run the new :LSClientLineDiagnostics command to display all diagnostics on the current line and to un-truncate multi-line error messages. Big thanks to @ayoub-benali for contributing several improvements to LSP.

Sublime Text#

It's recommended to upgrade to LSP v0.8.1, full changelogs:

Built-in "import build" dialogue#

It's now possible to respond to the "Import build" dialogue from Sublime Text without using the HTTP server.

Manual "import build" command#

It's now possible to manually trigger a build import from the command palette.

Import build command

See manually trigger build import for instructions how to configure this command.


The Emacs installation instructions have been improved thanks to @JesusMtnez.

Merged PRs#