Skip to main content

Metals v1.1.0 - Silver

· 12 min read

We're happy to announce the release of Metals v1.1.0, which brings stability fixes and takes another step towards bettering error detection and error reporting.

Commits since last release114
Merged PRs104
Contributors13
Closed issues32
New features2

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

Metals is a language server for Scala that works with VS Code, Vim, Emacs and Sublime Text. Metals is developed at the Scala Center and VirtusLab with the help from contributors from the community.

TL;DR

Check out https://scalameta.org/metals/, and give Metals a try!

New Scala versions support

Support for Scala 3.3.1

Scala 3.3.1 is a new version of the Scala 3 LTS and it adds support for JDK 16 records in Java sources.

For more information about the release take a look at https://github.com/lampepfl/dotty/releases/tag/3.3.1

Support for Scala 2.13.12

The main improvement of Scala 2.13.12 are actionable diagnostics. They are compiler suggested fixes for some errors and warnings. Actionable diagnostics are available in metals as code actions coming directly from the compiler.

For more information about the release take a look at https://github.com/scala/scala/releases/tag/v2.13.12

Build server connection status

Since the previous release metals detects and reports when the build server stops responding. Over the last months this feature was stabilized and the information about the build server connection is now visible in the status bar. For clients that don't support this status bar yet, the error message will be displayed as before.

bsp-status-conn Build server connection status in VSCode, when metals is successfully connected to sbt build server.

If you are a maintainer of a metals' client and want to know how to add support for build server status see Changes for clients.

Enable run code lens for Mill build server

Thanks to Tomasz Godzik now we have run code lens when using Mill build server. As a reminder, it's possible to start using it by running Metals: Switch build server command for a Mill project.

mill-run-lens

Convert single line comments to multiline

Thanks to Kasper Kondzielski we have a new code action that converts a block of single line comments into a multiline comment.

convert-to-multiline

Detect project root

Sometimes your Scala project root is not in the same folder that you open your editor in. Now metals will also detect the Scala project root when it is a child of the workspace/workspace folder root.

. *workspace root*
├── scalaProject *detected project root*
│ ├── .sbt
│ ├── src/main/scala
│ │ ├── Main.scala
│ │ └── ...
│ └── ...
├── someOtherProject
│ └── ...
├── .gitignore
└── ...

Error reports in metals doctor

Error reports are now visible in the metals doctor to help users diagnose the cause of any potential issue. Previously, they would only exist in the .metals/.reports folder.

show-error-reports

Show bloop errors

Before this release Bloop build server errors would only be logged silently into metals.log and the Metals output. Now for the sake of visibility Bloop errors are also shown to the users in form of error messages. The message can be dismissed for the current session of Metals or you can turn off all messages in a workspace.

Changes for plugin authors

Build server status

We added bspStatusBarProvider field to initialization parameters. Similarly to statusBarProvider it can have one of the following values: "on", "off", "log-message", "show-message" (default).

When bspStatusBarProvider is set to "on", the build server status is send via metals/status with new field "statusType" set to "bsp".

New fields in MetalsStatusParams:

  • statusType
    • "bsp" for build server status
    • "metals" for metals status (default)
  • level - severity level of the message, possible values: "info", "warn", "error"
  • commandTooltip - command tooltip, which can be appended to the status tooltip if the status bar supports commands

For more details refer to the PR.

Doctor results v5

New errorReports field in DoctorFolderResults containing an array of ErrorReportInfo, which has the following fields:

  • name string - display name of the error,
  • timestamp long - timestamp of the report creation date,
  • uri string - error report file uri,
  • buildTarget nullable string - optional build target that the error is associated with,
  • shortSummary string - short error summary,
  • errorReportType string - one of "metals", "metals-full", "bloop". For more details refer to the PR.

Miscellaneous

  • bugfix: incorrect docstring completions when not directly over definition (jkciesluk)
  • bugfix: don't use cache directory when incorrectly resolved path (tgodzik)
  • bugfix: skip empty lines when calculating indentation for auto import (kasiaMarek)
  • improvement: update ranges on Scala CLI actionable diagnostics for files with non-saved changes (LaurenceWarne)
  • bugfix: correctly choose the folder to use for a command (tgodzik)
  • bugfix: extract member with associated comments (kasiaMarek)
  • bugfix: handle EOF in java completions (kasiaMarek)
  • bugfix: workaround for missing span in reference to an extension method defined in the companion object (kasiaMarek)
  • improvement: automatically calculate last supported versions for semanticdb (tgodzik)
  • bugfix: escape special chars in test names (kasiaMarek)
  • bugfix: add moduleClass imported symbols in IndexedContext (fix for insert type annotation) (kasiaMarek)
  • bugfix: fix resolving main class/ test suite for multi-root projects (kasiaMarek)
  • bugfix: wait longer to connect to build tools other than Bloop (tgodzik)
  • improvement: don't create service for folders with non-Scala projects (kasiaMarek)
  • bugfix: semantic tokens for multiline strings in Scala3 worksheets (jkciesluk)
  • bugfix: incorrect docstring on parameters (jkciesluk)
  • improvement: trim hover body (kasiaMarek)
  • feature: user configuration per workspace folder (kasiaMarek)
  • bugfix: named args completions with default values (jkciesluk)
  • bugfix: exhaustive match on stale symbols (jkciesluk)
  • bugfix: fix docstring regex in semantic highlighting (jkciesluk)
  • improvement: add timeout to fix java version for sbt request (kasiaMarek)
  • bugfix: fix reporting "no response error" after laptop in sleep mode (kasiaMarek)
  • bugfix: match completions for type aliases in Scala 3 (kasiaMarek)
  • bugfix: handle created build server config before all content written (kasiaMarek)
  • improvement: only log mtgas resolve messages on resolution (tgodzik)
  • bugfix: dependency completions with double colon before version (using directives) (jkciesluk)
  • bugfix: semantic highlighting in worksheets starting with an empty line (jkciesluk)
  • bugfix: don't read file for InteractiveSemanticdbdb if it doesn't exist (tgodzik)

Contributors

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

$ git shortlog -sn --no-merges v1.0.1..v1.1.0
34 Katarzyna Marek
24 Scalameta Bot
22 Tomasz Godzik
10 Jakub Ciesluk
6 dependabot[bot]
4 rochala
4 scalameta-bot
4 tgodzik
2 Laurence Warne
1 Chris Kipp
1 Ethan Atkins
1 Jack Koenig
1 Kasper Kondzielski

Merged PRs

v1.1.0 (2023-10-17)

Full Changelog

Merged pull requests: