Skip to main content

Metals v0.5.1 - Mercury

· 4 min read

This release introduces minor improvements and bug fixes with highlights including:

  • auto-imports are inserted at the toplevel instead of locally
  • document symbol lists inner methods and anonymous classes
  • the recommended Vim client is now coc.nvim
  • diagnostics are cleared for deleted files
  • fuzzy symbol search no longer returns results for deleted files
  • find all references now handles synthetic update calls
  • deprecate older Scala versions

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 along with contributors from the community.

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

Automatic imports are placed globally instead of locally

Previously, auto-imports were placed locally like this:

object Main {
import scala.concurrent.Future // <- automatically added by Metals
val future = Future@@
}

Now, the import is inserted at the toplevel instead

import scala.concurrent.Future // <- automatically added by Metals

object Main {
val future = Future@@
}

Document symbols now shows inner methods and anonymous classes

Before:

image

After:

image

Diagnostics gracefully handle deleted files

Previously, deleting a file with compile errors would result in the stale diagnostics to stay until you restarted the Metals server. Now, diagnostics are cleared when a source file is deleted.

Fuzzy symbol search gracefully handles deleted files

Previously, fuzzy searching for a symbol could return results from deleted files. Now, fuzzy symbol search only shows results from files that exist on disk.

Find all references handles synthetic update calls

Previously, find all references did not catch references where an update() method call was synthesized.

val cache = mutable.Map.empty[String, String]
cache("a") = "b" // before: referenced `Map.update()` instead of `cache`

Now, the reference to cache in cache("a") = "b" is indexed as well as the synthetic call to the Map.update() method.

Previously, the vim installation instructions recommended the vim-lsc client. Now, the installation instructions recommend coc.vim since it supports more functionality of the Language Server Protocol. If you use Vim, we recommend trying out coc.vim to enjoy more advanced features like completions with auto-imports.

Deprecate older Scala versions

Metals works with Scala 2.11 and Scala 2.12. Starting from the next release, Metals will drop support for the older patch versions of those series, and it will exclusively support these version:

  • 2.11.12
  • 2.12.7
  • 2.12.8

Starting from this release, we will show a warning at startup if you're using an outdated Scala version, prompting you to upgrade your project to the latest version.

Contributors

Big thanks to everybody who contributed to this release!

$ git shortlog -sn --no-merges v0.5.0..v0.5.1
Ólafur Páll Geirsson
Gabriele Petronella
Gabriel Volpe
JesusMtnez
Eric Peters
Arnout Engelen
Robin Green
Tomasz Godzik
David Strawn

Merged PRs

  • Upgrade to latest Scalameta. #702 (olafurpg)
  • Add question template #701 (gabro)
  • Don't return workspace/symbol results for deleted files. #695 (olafurpg)
  • Insert global imports instead of local imports. #692 (olafurpg)
  • Fix a dead link to Bloop site #691 (gabro)
  • Update a couple .lines to .linesIterator for java11 #688 (er1c)
  • Fix typo #687 (greenrd)
  • Handle document symbols for nested declarations #686 (gabro)
  • Update Emacs docs #681 (JesusMtnez)
  • Add "Coming from IntelliJ" section to VS Code docs. #678 (olafurpg)
  • Clear diagnostics on build import, fixes #644. #677 (olafurpg)
  • Disable flaky test on Appveyor. #676 (olafurpg)
  • Update stable version in issue template #671 (gabro)
  • Documenting coc.nvim as the recommended LSP client for Vim #665 (gvolpe)
  • Remove Deprecated Usage Of java.util.Date API #663 (isomarcte)
  • Link to vscode marketplace #661 (raboof)
  • Use correct GIF for signature help on landing page. #660 (olafurpg)
  • Document new features and write release announcement. #655 (olafurpg)
  • Make detail view in override not show unicode character. #654 (tgodzik)