Metals v1.6.3 - Osmium
We're happy to announce the release of Metals v1.6.3, which brings a number of improvements as well as interesting new features. This release has seen a lot of contributions from the community and we would like to thank everyone who helped with this release!
Commits since last release | 127 |
Merged PRs | 127 |
Contributors | 18 |
Closed issues | 33 |
New features | 8 |
For full details: https://github.com/scalameta/metals/milestone/82?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!
- MCP: Scalafix rule generation
- Commands: Add a "copy fqn" command
- Inlay hints: Add closing labels
- Refactoring: Automatically add imports when copying between files
- Testing: Add cursor-based target discovery for running closest main or test
- Testing: Implemented test discovery for Bazel
- Code actions: Convert infix to normal apply
- Code Actions: Implement
Convert to collect
code action
MCP: Scalafix rule generation
Metals now provides a new Model Context Protocol tool for generating Scalafix rules within the MCP server. This can be used to run refactorings generated by LLMs on your codebase.
Most of the work around publishing and running Scalafix rules is done by Metals itself, while the LLM is only responsible for generating the rule implementation and description.
This works best on smaller codebases, but can later be published and used in larger ones.
Each rule generated by the MCP server will be saved in the .metals/rules
directory and is a self-contained Scala CLI project.
An example query that can be used and has been tested with is:
Using MCP, generate a scalafix rule that will change expressions with filter and map
such as `.filter(x => x > 1).map(x => x * 2)` into collect statements like `.collect{case x if x > 1 => x * 2}`
When used with Claude Code or Cursor (or your MCP-supporting LLM tool of choice), this will generate a finished rule in a few tries at a maximum.
The new tool is still experimental and there might be some rough edges, but we're happy to hear your feedback and suggestions! Some possible errors might involve not validating the inputs from the LLM properly or not returning an actionable enough error message.
Once generated, the rule can be run also using the metals.scalafix-run-only
command in the same workspace or published from the rule directory if not
already published when generating the rule.
Commands: Add a "copy fqn" command
Thanks to KacperFKorban we now have a new command that allows to copy the fully qualified name of a symbol to be used in places such as Scaladoc comments.
For example, if you have the following code:
package com.example
object Main {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
You can copy the fully qualified name of the main
method to obtain
com.example.Main#main
.
This command should be available in all editors that support 'workspace/executeCommand' LSP endpoint.
In Visual Studio Code, you can bind this command to a shortcut or invoke it from
the dropdown menu with your cursor on the symbol and select Copy reference
.
Inlay hints: Add closing labels
Another great feature added by KacperFKorban is the support for showing closing labels in inlay hints.
When this setting is enabled, each method/class/object definition that uses braces syntax will get a closing label hint next to the closing brace with the name of the definition.
For example:
object Main {
def main(args: Array[String]): Unit = {
println("Hello, world!")
} /*main*/
} /*Main*/
Where /*main*/
and /*Main*/
are the closing labels.
This can be enabled by setting the metals.inlayHints.closingLabels.enable
setting.
The feature is currently available only for Scala 2, we are planning to add support for Scala 3 in the near future.
Let us know what you think!
Refactoring: Automatically add imports when copying between files
In this release, thanks to kasiaMarek there is a new paste command that allows to automatically add imports when copying between files. This command is enabled by default in Scala files within VS Code and requires the origin to be filed when adding in other editors.
The change will currently only work for Scala 2, some further work is needed to add support for Scala 3.
Testing: Add cursor-based target discovery for running closest main or test
Another new code action, added by warcholjakub, is one that allows to run the closest main or test to the cursor.
This new command is available in Visual Studio Code via metals.run-closest
in
the command palette and can be assigned to a new shortcut.
Testing: Test discovery for Bazel
Up until this release, discovering tests in your Bazel workspace was not supported. This was because Bazel BSP server itself doesn't provide any information about test suites as other build tools and servers are able to.
Metals will now use semanticdb to discover test suites and test cases for Bazel only. This means you need to have semanticdb enabled in your Bazel workspace for this to work.
Thanks to pielas for his great work!
Code actions: Convert infix to normal apply
Thanks to yoosefi12 we now have a new code action that allows to convert infix apply to normal apply.
This means that whenever you see an infix apply such as:
mystring startsWith "hello"
you can convert it to a normal apply by choosing the correct code action.
mystring.startsWith("hello")
This doesn't apply to infix apply that are symbolic operators, such as '+', '*', etc. which are expected to be infix.
Code actions: Implement Convert to collect
code action
Another new code action added is one that allows to convert filter and map chains into collect statements.
For example with the following code:
List(1, 2, 3, 4).filter(x => x > 2).map(x => x * 2)
you can convert it to a collect statement by invoking the code action.
List(1, 2, 3, 4).collect {
case x if x > 2 => x * 2
}
Thanks to scarf005 for working on this!
Contributors
Big thanks to everybody who contributed to this release or reported an issue!
$ git shortlog -sn --no-merges v1.6.2..v1.6.3
54 Tomasz Godzik
43 scalameta-bot
6 Jakub Warchoł
5 Mateusz Piękos
2 Alec Theriault
2 Kacper Korban
2 Zieliński Patryk
2 dependabot[bot]
2 ormaniec
1 Alexandre Archambault
1 Ali Yoosefi
1 Connor Taffe
1 Jędrzej Rochala
1 Konrad Gądek
1 Matt Bovel
1 Panov Ivan
1 eugene yokota
1 scarf
Merged PRs
v1.6.3 (2025-10-16)
Merged pull requests:
- improvement: Improve generating scalafix rules #7898 (tgodzik)
- bugfix: Readd build tool when missing #7897 (tgodzik)
- chore: Fix flakiness with ServerLivenessMonitorLspSuite #7896 (tgodzik)
- improvement: Allow to run generated rules #7894 (tgodzik)
- 7824 convert infix apply #7890 (yoosefi12)
- build(deps): Update flyway-core from 11.13.3 to 11.14.0 #7895 (scalameta-bot)
- bugfix: Fix docs cross suite on the next Scala 2.13 #7893 (tgodzik)
- improvement: Reset workspace should properly clean and restart build server #7892 (tgodzik)
- Fixed MainClassNotFound or SemanticDbNotFound in case of executing "Run without debugger" on clean build #7889 (pielas)
- Implemented test discovery for Bazel #7769 (pielas)
- build(deps): Update sbt-scalafix, scalafix-interfaces from 0.14.3 to 0.14.4 #7886 (scalameta-bot)
- build(deps): Update flyway-core from 11.13.2 to 11.13.3 #7888 (scalameta-bot)
- improvement: Don't require a name when generating a scalafix rule #7883 (tgodzik)
- docs: Remove gitpod as it's no longer available #7884 (tgodzik)
- bugfix: Fix issue with not adding | in the last line #7880 (tgodzik)
- bugfix: Fix issues with tests using sql.Date #7879 (tgodzik)
- Fix: Wait for compilation before run/debug #7877 (pielas)
- Update Bloop and docs #7870 (tgodzik)
- bugfix: Fix issues with didPaste functionality #7871 (tgodzik)
- build(deps): Update sbt-jmh from 0.4.7 to 0.4.8 #7876 (scalameta-bot)
- build(deps): Update sbt, scripted-plugin from 1.11.6 to 1.11.7 #7875 (scalameta-bot)
- build(deps): Update bloop-rifle from 2.0.15 to 2.0.16 #7874 (scalameta-bot)
- bugfix: Don't use bsp version as Bazel fallback version #7817 (tgodzik)
- Closing labels #7815 (KacperFKorban)
- Add RawPresentationCompiler interface #7841 (rochala)
- improvement: Add an ability to force resetting metals #7838 (tgodzik)
- build(deps): Update coursier, ... from 2.1.25-M18 to 2.1.25-M19 #7868 (scalameta-bot)
- build(deps): Update bloop-config from 2.3.2 to 2.3.3 #7865 (scalameta-bot)
- Improve file move refactoring: preserve import structure and use full package names #7862 (pielas)
- build(deps): Update bloop-rifle from 2.0.14 to 2.0.15 #7866 (scalameta-bot)
- build(deps): Update mill-contrib-testng from 1.0.5 to 1.0.6 #7867 (scalameta-bot)
- bugfix: Fix mill tests #7863 (tgodzik)
- bugfix: Fix issues with Bloop being started instead of sbt server #7864 (tgodzik)
- build(deps): bump actions/checkout from 4 to 5 #7849 (dependabot[bot])
- build(deps-dev): bump @types/node from 24.1.0 to 24.6.1 in /website #7852 (dependabot[bot])
- chore: Gather all dependabot updates #7861 (tgodzik)
- chore: Add support for Scala 2.13.17 #7846 (tgodzik)
- bugfix: Add missing ++ to changing Scala version #7860 (tgodzik)
- bugfix: Force Scala version for mtags in a different place #7859 (tgodzik)
- bugfix: Force Scala version when releasing mtags #7858 (tgodzik)
- chore: Remove old mtags workflow and fix new #7857 (tgodzik)
- chore: Update Java version in the mtags-release workflow #7856 (tgodzik)
- chore: Add custom workflow for releasing Mtags #7855 (tgodzik)
- deps: Update to sbt 2.0.0-RC6 #7843 (eed3si9n)
- bugfix: Don't remove diagnotics if a file is duplicated across targets #7840 (tgodzik)
- improvement: Do not return the full formatting #7760 (tgodzik)
- build(deps): Update flyway-core from 11.13.1 to 11.13.2 #7842 (scalameta-bot)
- fix: Move dead test to correct suite to correctly detect degradation #7834 (ormaniec)
- bugfix: Run javap properly when in source dependencies #7829 (tgodzik)
- build(deps): Update h2 from 2.3.232 to 2.4.240 #7835 (scalameta-bot)
- build(deps): Update giter8 from 0.17.0 to 0.18.0 #7837 (scalameta-bot)
- chore: Make sure that mtagsShared compile with JDK 8 #7833 (tgodzik)
- chore: Bump bloop gradle plugin to 1.6.4 #7832 (tgodzik)
- bugfix: Revert timeout, the default is 1 hour. #7830 (tgodzik)
- bugfix: Add omitted tests to test groups #7831 (tgodzik)
- chore: Update sbt 2 to 2.0.0-RC5 #7826 (tgodzik)
- docs: Remove no longer relevant mention #7827 (tgodzik)
- chore: Update Bloop to 2.0.14 #7822 (tgodzik)
- improvement: Test and release using 2.0.0-RC4 #7716 (tgodzik)
- build(deps): Update scalameta, semanticdb-metap, ... from 4.13.9 to 4.13.10 #7820 (scalameta-bot)
- build(deps): Update cli_3, scala-cli-bsp from 1.9.0 to 1.9.1 #7821 (scalameta-bot)
- fix: go to definition inside of SAM lambda #7819 (harpocrates)
- build(deps): Update munit from 1.1.1 to 1.2.0 #7814 (scalameta-bot)
- Revert "bugfix: Run close when stopping the presentation compiler" #7818 (tgodzik)
- fix: filter out invalid
<empty>
package imports from quickfix actions #7795 (warcholjakub) - bugfix: Don't show InvalidSymbolException #7809 (tgodzik)
- improvement: Retry self-type-in-lib test #7808 (tgodzik)
- feat: add cursor-based target discovery for running closest main or test #7718 (warcholjakub)
- build(deps): Update guava from 33.4.8-jre to 33.5.0-jre #7810 (scalameta-bot)
- build(deps): Update flyway-core from 11.12.0 to 11.13.1 #7813 (scalameta-bot)
- build(deps): Update mill-contrib-testng from 1.0.4 to 1.0.5 #7811 (scalameta-bot)
- fix: Add correct indexing of external libraries #7782 (ormaniec)
- Add a "copy fqn" command #7424 (KacperFKorban)
- bugfix: Don't use timeout on MacOS, where it doesn't exist #7807 (tgodzik)
- fix: override mtags-interfaces snapshot dependency for problematic Scala 3.x versions #7794 (warcholjakub)
- fix: change workspace symbol search to include extension methods #7792 (warcholjakub)
- build(deps): Update protobuf-java from 4.32.0 to 4.32.1 #7786 (scalameta-bot)
- build(deps): Update ujson from 4.3.0 to 4.3.2 #7787 (scalameta-bot)
- build(deps): Update mcp from 0.12.0 to 0.12.1 #7788 (scalameta-bot)
- build(deps): Update scala3-library from 3.7.2 to 3.7.3 #7789 (scalameta-bot)
- feat: show organize imports failure as status bar notification #7771 (warcholjakub)
- build(deps): Update sbt, scripted-plugin from 1.11.5 to 1.11.6 #7779 (scalameta-bot)
- build(deps): Update xnio-nio from 3.8.16.Final to 3.8.17.Final #7778 (scalameta-bot)
- build(deps): Update mcp from 0.11.3 to 0.12.0 #7773 (scalameta-bot)
- build(deps): Update flyway-core from 11.11.2 to 11.12.0 #7774 (scalameta-bot)
- build(deps): Update github-api from 1.329 to 1.330 #7775 (scalameta-bot)
- build(deps): Update cli_3, scala-cli-bsp from 1.8.5 to 1.9.0 #7776 (scalameta-bot)
- build(deps): Update ujson from 4.2.1 to 4.3.0 #7772 (scalameta-bot)
- Add "Show Logs" button for partial import failure #7755 (mbovel)
- improvement: Retry downloading with fallbacks for scalafmt #7762 (tgodzik)
- feat: implement
Convert to collect
code action #6969 (scarf005) - build(deps): Update mill-contrib-testng from 1.0.3 to 1.0.4 #7757 (scalameta-bot)
- improvement: Fix issues with Bazel 8 #7753 (tgodzik)
- bugfix: Support experimental imports #7734 (tgodzik)
- build(deps): Update jackson-databind from 2.19.2 to 2.20.0 #7756 (scalameta-bot)
- build(deps): Update mcp from 0.11.2 to 0.11.3 #7758 (scalameta-bot)
- build(deps): Update coursier, ... from 2.1.25-M17 to 2.1.25-M18 #7740 (scalameta-bot)
- improvement: Test metals on latest stable java version #7748 (tgodzik)
- Fix typed-glob-search to handle JSON string symbolType parameter with fallback #7738 (zielinsky)
- bugfix(Scala-2): add arg name to pattern match type hint #7652 (kgadek)
- fix(hover): allow hover on whitespace inside backtick identifiers #7739 (warcholjakub)
- Java PC: hide non‑static members in class context (Fixes #6356) #7743 (VankaTaganai)
- build(deps): Update semanticdb-java from 0.11.0 to 0.11.1 #7744 (scalameta-bot)
- Fixed sbt reload by excluding conflicting unroll-annotation dependencies #7747 (pielas)
- build(deps): Update sbt, scripted-plugin from 1.11.4 to 1.11.5 #7746 (scalameta-bot)
- build(deps): Update flyway-core from 11.11.1 to 11.11.2 #7741 (scalameta-bot)
- build(deps): Update jsoup from 1.21.1 to 1.21.2 #7745 (scalameta-bot)
- Update coursier to 2.1.25-M17 and coursier-interface to 1.0.29-M2 #7736 (alexarchambault)
- bugfix: Don't show success as error when running the rule #7731 (tgodzik)
- feature: Add MCP tool to generate and run scalafix rules #7664 (tgodzik)
- build(deps): Update sbt-ci-release from 1.11.1 to 1.11.2 #7729 (scalameta-bot)
- feat: fetch
test-agent
inDownloadDependencies
#7728 (harpocrates) - bugfix: Make list recursive skip failing files #7701 (tgodzik)
- improvement: Improve descriptions for discoverability. #7727 (tgodzik)
- bugfix: Set Bloop plugin version to 2.0.10 for pre 1.9.0 #7725 (tgodzik)
- improvement: Retry flaky implementation suite #7719 (tgodzik)
- build(deps): Update protobuf-java from 4.31.1 to 4.32.0 #7722 (scalameta-bot)
- build(deps): Update flyway-core from 11.11.0 to 11.11.1 #7724 (scalameta-bot)
- build(deps): Update mcp from 0.11.1 to 0.11.2 #7723 (scalameta-bot)
- Fix manual signature help triggering for superclass constructors #7714 (zielinsky)
- improvement: Index toplevel members from dependencies #7710 (tgodzik)
- bugfix: Fix issue with flaky CI tests again #7717 (tgodzik)
- improvement: Also show warnings when using mcp compile tools #7709 (tgodzik)
- build(deps): Update flyway-core from 11.10.5 to 11.11.0 #7715 (scalameta-bot)
- improvement: Fix issues with races on CI #7713 (tgodzik)
- Add
resolve-stacktrace-location
LSP command #7711 (cptaffe) - docs: Add release notes for 1.6.2 #7712 (tgodzik)