Skip to main content

Metals v1.5.2 - Strontium

· 13 min read

We're happy to announce the release of Metals v1.5.2, which continues to improve overall user experience and stability of Metals. This release includes a number of new features, bug fixes and improvements. Especially worth mentioning is the fix for the Scala 2 issue, which previously caused most interactive features to break when using a type defined in a package object.

Commits since last release145
Merged PRs132
Contributors16
Closed issues42
New features5

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

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

Deduplicate compile requests

In previous versions of Metals, we would sometimes send multiple compile requests for the same file expecting most of them to be fast. This worked reliably well in Bloop, but not so much in a lot of other build servers such as sbt.

Thanks to kasiaMarek we will try not to send multiple requests if we know a file hasn't changed between them. This should help in a number of cases and make the experience more reliable.

Add exact location for the test failure

Previously, when running tests in Metals with VS Code Test Explorer, the location of the test failure was not shown, only the start of the test case. Now, we will correctly show the exact location of the test failure, which should make it easier to navigate to the failing test.

test-loc

Convert sbt style deps on paste in for scala-cli

Thanks to majk-p any sbt style dependencies that you paste into a Scala CLI file after //> using dep will be automatically converted to Scala CLI style dependencies. This was previously only supported in a code action, but turns out to be useful enough to apply the rewrite automatically on paste.

paste-dep

Add test cases discovery for TestNG

Thanks to kasiaMarek it's now possible to run TestNG tests inside Metals, which was previously not possible.

This would mean following test cases will now show lenses or test explorer icon next to them:

import org.testng.annotations.Test

class TestNG {
@Test
def testOK(): Unit = {
assert(true)
}
}

Improvements to automatic imports

Whenever importing a particular symbol, Metals would previously suggest all the possible symbol with the expected name. However, in a lot of cases, those symbol might already have a method being invoked on them, which means that only symbols containing that method should be suggested.

For example in the following code:

object O{
Future.successful(1)
}

we don't need to suggest java.concurrent.Future, but only scala.concurrent.Future since only the latter contains the successful method. If none of the symbols contains that specific method, we will revert to showing all symbols. Let us know if this is a helpful behaviour or if you see additional cases where this could be improved.

Remove Ammonite script support

Some time ago we have asked in discussions in our Github repository about the possibility of removing support for Ammonite scripts. We have not received any overwhelming feedback to keep it, so we have decided to remove it. If you have any concerns or questions about this change, please let us know.

The removal was directly prompted by the fact that there were serious issues with Ammonite support with no users reporting them or anyone from maintainers being aware of them. Which points to the fact that the feature is not widely used.

This will also help to to ease the maintenance burden and to focus more on stability of Metals. Scala Scripts still are and will be supported via Scala CLI, so for anyone using Ammonite we suggest switching to Scala CLI. Scala CLI is the default Scala runner for Scala 3 and we believe it offers overall better experience. If you see any useful Ammonite feature missing from Scala CLI don't hesitate to start a discussion in the Scala CLI repository.

Miscellaneous

  • bugfix: Also infer type with complex expressions before method invocation tgodzik
  • bugfix: fix typeDefinition on backticked identifier harpocrates
  • bugfix: Fix when types are coming from package objects tgodzik
  • bugfix: Infer arg type properly when method uses complex parameters tgodzik
  • improvement: convert workspace folder to be a Metals project on chosen commands kasiaMarek
  • Fix extracting values for fewer braces majk-p
  • bugfix: Regenerate mill BSP config on incorrect version kasiaMarek
  • bugfix: Add missing completion in args in generic method with default args harpocrates
  • improvement: Add file location also to stacktrace printed to stdout kasiaMarek
  • bugfix: Don't propose inaccessible named arg defaults harpocrates
  • feature: Support completions inside of backticks harpocrates
  • bugfix: Support show decompiled and show tasty for Bazel kasiaMarek
  • bugfix: Fix invalid config message when multiple scalafmt files are used with 'include' Sporarum
  • bugfix: don't propose inaccessible named arg defaults harpocrates
  • bugfix: don't prefix scope completions from supertype harpocrates
  • Add function params selection range blaz-kranjc
  • bugfix: Don't fail when deleting temporary files tgodzik
  • bugfix: Treat self types as parent types in go to implementation context KacperFKorban zainab-ali kasiaMarek
  • fix: look for implementations in rename for possibly overridden type aliases kasiaMarek
  • improvement: Ask to start http server if not running (tgodzik)
  • improve error messages when no main classes can be found cvogt
  • fix: go to def should lead to all apply, object and class (Scala 2) kasiaMarek
  • improvement: Add jar search command to metals view tgodzik
  • fix: generate auto-imports for more pattern completions (harpocrates)
  • fix: colliding pattern and scope completions #7295 (harpocrates)
  • improvement: add CompileTarget server command cvogt
  • bugfix: Try and improve credentials handling when downloading dependencies tgodzik
  • Suggest open diagnostics for debug compile errors cvogt
  • feat: convert sbt style deps on paste in for scala-cli test.dep scarf005
  • bugfix: Fix issues when we would rename more symbols than needed tgodzik
  • bugfix: Make sure to choose the best import option in unambiguous cases tgodzik
  • improvement: Add scalafix and Scala 3 Presentation Compiler to DownloadDependencies tgodzik

Contributors

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

$ git shortlog -sn --no-merges v1.5.1..v1.5.2
38 Tomasz Godzik
24 Scalameta Bot
16 scalameta-bot
10 kasiaMarek
7 dependabot[bot]
6 Alec Theriault
5 Blaz Kranjc
4 tgodzik
3 Christopher Vogt
3 Katarzyna Marek
2 Chris Birchall
1 Francesco Nero
1 Kacper Korban
1 Lorenzo Gabriele
1 Quentin Bernet
1 Seth Tisue
1 scarf

Merged PRs

v1.5.2 (2025-03-18)

Full Changelog

Merged pull requests: