Skip to main content

Metals v0.10.7 - Tungsten

We're happy to announce the release of Metals v0.10.7, which mostly focuses on support for Scala 2.12.15 and refines the indent on paste functionality.

Commits since last release42
Merged PRs14
Contributors6
Closed issues4
New features1

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

  • Scala 2.12.15 and 3.1.0-RC2 support.
  • Indent on paste improvements.
  • Show TASTy command.

Indent on paste improvements#

In Metals 0.10.6 we introduced a new feature that would adjust the indentation of any pasted snippet. You can read about it in previous release notes.

The feature was not fully mature and despite our best intentions it could cause a lot of issues for the users. To help with that we introduced two changes.

Firstly, we will now use the current indentation of the cursor and adjust any pasted snippet to use that level of indentation.

For example in case of a simple snippet like:

def hello() =
println("Hello!")

if we paste it into:

def main() =
println("Main")
|

after pasting we will have:

def main =
println("Main")
def hello() =
println("Hello!")

However, if we move the cursor back:

def main() =
println("Main")
|

the result will be different:

def main =
println("Main")
def hello() =
println("Hello!")

You can use it to paste anything at the indentation level you need.

Moreover, we also added a new setting metals.enableIndentOnPaste, which you can use to turn the feature on and off. Currently, it's off by default. We highly recommend turning it on, testing out some more and reporting any new issues.

We also included a number of fixes for indentation in the Visual Studio Code extension, which should fix some problems in the Scala 3 optional braces code.

Show TASTy command#

What is TASTy? According to the official Scala documentation:

TASTy is an acronym that comes from the term Typed Abstract Syntax Trees. It's a high-level interchange format for Scala 3, and in this document we'll refer to it as Tasty. Tasty files are generated by the scalac compiler, and contain all of the information about your source code, including the syntactic structure of your program, and complete information about types, positions, and even documentation.

Thanks to kpodsiad, Metals can now show TASTy of a currently opened file using the new metals.show-tasty command. However, keep in mind that currently, this feature works only for Scala 3 sources. You can use this new command already in nvim-metals and Visual Studio Code.

Contributors#

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

$ git shortlog -sn --no-merges v0.10.6..v0.10.7
Kamil Podsiadlo
Tomasz Godzik
Vadim Chelyshov

Merged PRs#

v0.10.7 (2021-09-16)#

Full Changelog

Merged pull requests: