Skip to main content

Metals v1.2.1 - Bismuth

Β· 10 min read
Katarzyna Marek
Katarzyna Marek

We're happy to announce the release of Metals v1.2.1, which brings an array of bugfixes and adds initial support for Bazel as a build tool.

Commits since last release123
Merged PRs99
Contributors14
Closed issues52
New features4

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

Help us make Metals even better by informing us on any issues or missing features. It's as simple as creating a πŸ› bug report or a πŸš€ feature request in the Metals GitHub repository.

TL;DR​

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

Bazel support​

This release brings support for using Bazel as a build tool with many features like completions and go-to-definition working out of the box. To have the features working also for dependencies, make sure to enable fetch_sources for library dependencies in Bazel definition.

The initial work on Bazel support was started by kpodsiad, continued on by tanishiking, and finally brought to completion by jkciesluk, with tgodzik contributing additional improvements to the area.

bazel completions Completions in a Bazel project.

bazel go to definitions Hover and go to definition in a Bazel project.

You can get the slightly more advanced features working by enabling SemanticDB in your project. Simply add the following content to your build:

  • in your BUILD file:

    load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain")

    scala_toolchain(
    name = "semanticdb_toolchain_impl",
    enable_semanticdb = True,
    semanticdb_bundle_in_jar = False,
    visibility = ["//visibility:public"],
    )

    toolchain(
    name = "semanticdb_toolchain",
    toolchain = "semanticdb_toolchain_impl",
    toolchain_type = "@io_bazel_rules_scala//scala:toolchain_type",
    visibility = ["//visibility:public"],
    )
  • and in your WORKSPACE file:

    register_toolchains(
    "//:semanticdb_toolchain",
    )

bazel add semanticdb Adding SemanticDB to a Bazel project.

Enabling SemanticDB in your Bazel project will allow you to use such features as go to references.

bazel go to references Go to references in a Bazel project.

You can read more about Metals current support for Bazel and setting it up in documentation. Our Bazel support is still in the early stages but we'd love to get your feedback!

Run for Native and JS platforms​

Thanks to tgodzik, starting with this release you can run your code using native and js platforms straight from the editor. Just click on the run code lens or trigger debug run in any other way appropriate for your editor of choice.

run native Running a Scala Native program using code lenses.

Metals view for uncompiled changes​

In the previous release, metals view was enhanced and brought to Scala 3. You can read more about that here. The feature was further improved by tgodzik, and now the information about workspace symbols is updated as you write, instead of on compile as before.

tree view update Tree view updating while typing.

LSP Progress support​

For clients that do not support metals status, slow tasks notifications can now also be available via LSP Progress thanks to work done by keirlawson.

Miscellaneous​

This release brings also many bug fixes and improvements. Check them out to know what has changed.

  • [Scala 3] bugfix: Don't show workspace completions for implicit classes members. jkciesluk
  • bugfix: Pass proxy information to g8. kasiaMarek
  • bugfix: Fix go to definition for nested java jars. kasiaMarek
  • [Scala 3] improvement: Better labels for workspace methods completions. jkciesluk
  • improvement: Discover sbt in path before fallbacking to launcher. kasiaMarek
  • improvement: Only save scala or java fingerprints. tgodzik
  • bugfix: Offer auto-import for new classes created via file provider. kasiaMarek
  • improvement: Add support for tests using weaver cats effects. kasiaMarek
  • bugfix: Show run/debug code lenses when file contains shebang header. kasiaMarek
  • bugfix: Make debug completions independent of the order of stackTrace being requested. mekpavit
  • bugfix: Fix go to definition for toplevel definitions in files with . in the name. kasiaMarek
  • improvement: Add case keyword completion. jkciesluk
  • bugfix: Don't tokenize if the source hasn't changed. tgodzik
  • bugfix: Handle missing line argument in debug completion request. mekpavit
  • feature: Cancel worksheet evaluations when canceling compilation. ckipp01
  • feature: Show import renames in hover. kasiaMarek
  • [Scala 2] bugfix: Document highlight in self type. jkciesluk
  • improvement: Remove semantic tokens fallback. jkciesluk
  • bugfix: Handle missing jar file in SetBreakpointRequest. adpi2
  • bugfix: Don't show default argument values if type is Any. tgodzik
  • [Scala 3] bugfix: Don't show givens as completions from classpath search. kasiaMarek
  • [Scala 3] bugfix: Don't show scope completions inside multi-imports. kasiaMarek
  • improvement: Show workspace completions for short queries. kasiaMarek
  • improvement: Add atomic update on TrieMap. jkciesluk
  • bugfix: Fix StacktraceAnalyser in case of empty package. tgodzik
  • [Scala 3] bugfix: Wrong span in extension methods in context functions. jkciesluk
  • bugfix: Fix searching for implementations of an abstract type. tgodzik
  • bugfix: Fix java support (hover/completions) for symbols from dependencies. tgodzik
  • [Scala 3] improvement: Suggest workspace completions for implicit classes. tgodzik
  • bugfix: Extract method with empty lines. kasiaMarek
  • feature: Add option to run verbose compilation. tgodzik
  • improvement: Fetch missing dependency sources. kasiaMarek

Contributors​

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

$ git shortlog -sn --no-merges v1.2.0..v1.2.1
38 Tomasz Godzik
31 Katarzyna Marek
17 Jakub Ciesluk
10 scalameta-bot
6 rochala
5 Scalameta Bot
5 mekpavit
3 dependabot[bot]
2 Chris Kipp
2 Sakib Hadziavdic
1 Adrien Piquerez
1 Kamil PodsiadΕ‚o
1 Keir Lawson
1 tgodzik

Merged PRs​

v1.2.1 (2024-02-07)​

Full Changelog

Merged pull requests: