Skip to main content

Metals v0.10.6 - Tungsten

We're happy to announce the release of Metals v0.10.6, which brings about new Scala 3 versions and JDK 17 support in addition to some new interesting features.

Commits since last release173
Merged PRs74
Contributors16
Closed issues25
New features4

For full details: https://github.com/scalameta/metals/milestone/41?closed=1

Metals is a language server for Scala that works with VS Code, Vim, Emacs, Sublime Text 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!

  • Automatically adjust indentation on paste.
  • New code actions.
  • Allow organize imports on unsaved code.
  • [Scala 3] support for Scala 3.0.2 and 3.1.0-RC1.
  • JDK 17 support.

Automatically adjust indentation on paste#

Starting with Scala 3 developers can use optional braces, which we mentioned in some of the previous release notes. One of the main problems with it is making sure that users are able to properly paste code into existing blocks. Previously we could just paste into braced blocks and adjusted the indentation later, but now it really matters that indentation is changed properly in order to make to code compile correctly.

To help with that @Giggiux adjusted the existing range formatting to account for indentation in the pasted blocks. Starting from this release Metals will adjust the indentation to match that of the enclosing block irrelevant of whether it has braces or not. A number of improvements has also been done to make sure the cursor ends up on the correct indentation level upon writing a newline.

indentation

If you encounter any issues, please don't hesitate to report them since the functionality is new and there might be some edge cases where it doesn't work. This was tested internally over the past month, but that doesn't account for all the different styles of how people write their code. You can turn off on paste formatting in Visual Studio Code in the settings using the editor.formatOnPaste property. This feature will only work with the editors that support range formatting.

New code actions#

This release benefits from adding two new code actions. Actions are based on particular scenarios, where we might automate some mundane coding and their behaviour is usually clearly specified. Please let us know if there are any other particular situations, which might be automated, via the the Metals's feature requests repository.

Refactor pattern match with placeholder#

Thanks to kpodsiad it's now possible to automatically rewrite lambdas with _ match expressions to partial functions:

partial-func

Replace () with {} in functions and vice versa#

It's quite often that in Scala we might want to change to a simple lambda to a multiline one or vice versa. This has previously been a manual chore, but now whenever possible you can do it via a code action:

replace

Allow organize imports on unsaved code#

In previous version it was only possible to organize imports in files that were saved and compiled. We're happy to report that this requirement has been lifted and users can organize imports whenever needed.

Miscellaneous#

  • Fix completions for definitions from other files in Ammonite scripts.
  • Support for Apple M1 and JDK 17. @dos65
  • [Scala 3] Show extension methods in hover.
  • Support brackets in multiline strings. @kpodsiad
  • Automatically convert $ to $$ when changing to string interpolation.
  • Filter out wrong reference results from unrelated build targets. @dos65
  • Greatly improved parent code lenses performance and turned it on by default in VS Code. @tanishiking
  • Properly show folding ranges in Scala 3 indented blocks. @tpasternak
  • Fix comments erasing all later variables in .env file.
  • Fix file watcher in large projects on macOS. @pvid
  • Fix memory leak issue in Scala 3 projects. @dos65

Contributors#

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

$ git shortlog -sn --no-merges v0.10.5..v0.10.6
Tomasz Godzik
Luigi Frunzio
Vadim Chelyshov
Adrien Piquerez
Chris Kipp
Pavol Vidlicka
Gabriele Petronella
Kamil Podsiadlo
Oliver Schrenk
Ólafur Páll Geirsson
Rikito Taniguchi
Tomasz Pasternak

Merged PRs#

v0.10.6 (2021-09-06)#

Full Changelog

Merged pull requests: