Skip to main content

Metals v0.8.1 - Cobalt

· 9 min read

We are excited to announce the release of Metals v0.8.1. This release includes a large number of bug fixes and some new features.

Commits since last release313
Merged PRs100
Contributors19
Closed issues52
New features2

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

  • insert missing abstract members
  • new file provider
  • enable rename preview for Visual Studio Code
  • debug and run working in Emacs

Insert missing abstract members

Thanks to yet again amazing work by tanishiking, we now support the quick fix code action for implementing abstract class members. This code action is available in case of errors and works in the same way as the recent "Implement all members" completion. It will add any missing abstract members at the top of the class with the default implementation of ???.

action

New file provider

In the last release we added support for worksheets, which are an easy way to quickly evaluate some code. To create a new worksheet you need to create a file with the extension .worksheet.sc, which was not that easy to figure out. To fix that situation, thanks to alekseiAlefirov, we now have a menu to create different types of new files including classes, traits, object, package objects and of course worksheets. At this time it's only available in the Visual Studio Code and coc-metals extensions.

new-file-provider

You can also just use the command Metals: New Scala File, which will use the current file's directory and create the new file there. And additionally, when using a relative path like a/b/C Metals will create all needed directories and add a proper package declaration to the new file.

Enable rename preview for Visual Studio Code

Rename previews were added in the last Visual Studio Code release, which enable users to see what will be changed when a rename is executed. Due to optimization and UX reasons Metals renamed symbols in closed files in the background without informing the editor. However, this also causes the previews to be misleading, since they might not be complete.

To fix that situation we now send all the files to VS Code, which then is able to display the preview. We do it, however, for up to 300 files, which threshold was experimentally estimated. When the number of files reaches over that number, we revert to the old behavior of not opening closed files. The reason for this is that in some cases for larger numbers of files the editor could hang and become unresponsive.

Debug in Emacs

In the last release run and debug support was only available for Visual Studio Code, but thanks to amazing work by the contributors it is now possible to use it in Emacs via lsp-mode's metals settings and dap-mode.

Other changes

This release includes mostly fixes and minor features, which is due to the large scope of the last one. We concentrated this last month on stability and making sure everything is up to scratch. Those minor changes included:

  • use bloop.export-jar-classifiers property when importing the build from sbt
  • ignore bad compiler options passed by users in order not to break completions
  • add an override for the Bloop plugin version and promote it to LSP settings
  • fix onTypeFormatting when used in top level multi-line strings
  • fix issues when go to implementation resolves local symbols
  • change the non-fatal jar error to debug rather than log warning
  • add support for worksheets without a build target by defaulting to Metals Scala version
  • rename file only if the renamed symbol is directly enclosed by a package
  • fix exhaustive match completion on Java enums
  • use workspace level Gradle wrapper if present for bloopInstall
  • fix onTypeFormatting issue with multiple pipes on a line
  • fix rename issues with backticks
  • add documentation on how to use proxies and mirrors

Contributors

Big thanks to everybody who contributed to this release!

Again, we have some new contributors and a lot of returning ones!

$ git shortlog -sn --no-merges v0.8.0..v0.8.1
Olafur Pall Geirsson
Tomasz Godzik
Scala Steward
Chris Kipp
Gabriele Petronella
Rikito Taniguchi
Aleksei Alefirov
Jakub Kozłowski
Arthur McGibbon
Carlos Rodriguez Guette
Danil Bykov
Jakob Odersky
Joris
Martin Duhem
Ruslans Tarasovs
Win Wang
joriscode
Kei Sunagawa
Zainab Ali

Merged PRs

v0.8.1 (2020-02-26)

Full Changelog

Merged pull requests: