Skip to main content

Metals v1.0.0 - Silver

· 19 min read

We're happy to announce the release of of Metals v1.0.0, which was a long time in the making. This release is a culmination of a lot of work from the community and the core Metals team. As it stands, Metals supports most of the important LSP features and beyond, which makes it equivalent to many IDEs, but in your favorite editor.

Bringing in version 1.0.0 doesn't mean that we don't have anything else to improve, but it means that we are confident that Metals is ready for production use in business and personal projects. We will continue to improve Metals and add new features, but we will also fully focus on making Metals the most productive and stable environment for all Scala developers. For that goal we are providing a number of reporting improvements that can help identify any problems you might have. There are more of these type of features coming your way.

Note for plugin authors: Starting from this release, any changes in minor version will mean that there are changes to the Metals behavior or json APIs that need to be accounted for.

Commits since last release211
Merged PRs181
Contributors17
Closed issues67
New features5

For full details: [https://github.com/scalameta/metals/milestone/num?closed=1] (https://github.com/scalameta/metals/milestone/_num_?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 Lunatech along with contributors from the community.

TL;DR

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

Add multi-root projects support

Up until this release, Metals could only be used in workspaces with a single root. This means that if for example you used the Add folder to Workspace option in Visual Studio Code to add a new folder to your workspace, Metals would not work in that folder. This is no longer the case and Metals will work in all folders in your workspace.

The work included making sure that all existing features work reliably and sensibly within multi root workspaces. For instance users will properly be shown a single Metals doctor (or a single HTTP server for editors that do not support the doctor interface). Test explorer will also show all tests from all folders clearly marked with the folder name. Most other commands will be invoked in the currently active folder in order not to create large cascading computations such as multiple folders compiling everything.

This tremendously useful improvement was authored by kasiaMarek. Take a look at the blogpost for more details!

Hover support in Java files

Another improvement for a better experience in Java files was contributed by VankaTaganai. Starting from this release you will be able to hover on names in Java files to see more information about them. This feature is primarily aimed at Scala developers that need to from time to time look into Java source and figure out what's going on there. This will not provide an experience of a full Java language server, but it will provide some basic functionality that will make it easier to work with Java sources.

java-hover

Please let us know about any issues! This is a new feature and we expect that it might take some time to get it ironed out.

Command for running specified scalafix rules

Users will now be able to run a single Scalafix rule on a file in their project. This might be particularly useful if you don't want to run everything at once and see exactly what is being done by each Scalafix rule.

This great usability improvement was done by LaurenceWarne.

Add clean-all command

This new feature has been demanded by users for a long while. Thanks to work done by jkciesluk, you will be able to run the metals.reset-workspace command to remove all the possible caches and compilation artifacts that might be causing issues in your workspace.

This should be seen as a last resort and used in as an alternative to the somewhat popular practice of blowing away your .metals/ and .bloop/ directories. Please do keep in mind that if you're finding that you need this often, it's probably a bug and should be reported.

Better support for Scala CLI

With Scala CLI becoming the official runner for Scala 3, we have been working on improving the support for it in Metals. This release brings a number of improvements that aim to improve both Scala CLI experience and the overall Scala experience.

This includes the following:

  • If there are no build tools present Metals will now fallback to Scala CLI, which means that even if a user creates a single file they will be able to run it and get all the proper support users would expect. If a build tool configuration appears in the workspace, Metals will suggest switching to that instead.
  • Scala CLI gets the same status as the already supported build tools, which means that we will not automatically suggest importing another build tool if we have Scala CLI already configured.
  • If project.scala is present in the workspace, Metals will suggest importing Scala CLI project, which includes automatically using the setupIde command to setup the .bsp configuration.

This splendid work was done by kasiaMarek

Support new Scala versions

Support for Scala 3.3.0

For more information about the release take a look at https://www.scala-lang.org/blog/2023/05/30/scala-3.3.0-released.html

Here we only show a short summary of the main feature from the release notes.

Linting

Scala 3.3.0 brings back linting to the Scala compiler. Right now, you can enable checking for unused symbols and discarded values. More linting options will come soon in the following Scala 3.3.x releases.

Fewer braces

Braces around method parameters can now be replaced with a colon. This can lead to cleaner, shorter, and often more readable code in places like configuration DSLs or test case definitions.

Boundary and break

Two new methods were added to the standard library: boundary and break. They are safer and more expressive replacements for non-local returns, which were deprecated recently.

break allows for a type-safe early escape from anywhere inside the block delimited by boundary to its end, returning the passed value from the entire block.

The new default implementation of lazy vals

Last but not least, we have changed the default implementation of lazy vals. The new implementation has better performance and is safer under parallel access. This may result in improvements in the performance of effect systems.

Support for Scala 2.12.18

This release improves compatibility by adding support for JDK 20 and 21 with ASM 9.5 upgrade.

It also aids migration to Scala 2.13 and Scala 3 with improvements for the -Xsource flag.

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

Support for Scala 2.13.11

Similar to Scala 2.12.18 this release improves compatibility by adding support for JDK 20 and 21 with ASM 9.5 upgrade.

It also aids migration to Scala 3 with improvements for the -Xsource flag with even more warnings. For more information about the release take a look at https://github.com/scala/scala/releases/tag/v2.13.11

Miscellaneous

  • bugfix: Show named argument completions inside constructors kasiaMarek
  • bugfix: Fix semantic highlight for @@ symbol jkciesluk
  • bugfix: Fix semantic highlight for multiline comments @@ symbol jkciesluk
  • improvement: Add selection expansion for multiline comments doofin
  • bugfix: Ignore shebang in .sc scripts tgodzik
  • bugfix: Semantic hightlight for extension methods type params kasiaMarek
  • bugfix: Add bloop package for mill bloop import command (fix for newer Mill versions) mehdimas
  • bugfix: Fix support for Java 12 to 16 adpi2
  • bugfix: Argument name completion for context function parameter kasiaMarek
  • bugfix: Fix highlight and rename for unapply in for comprehensions (jkciesluk)
  • bugfix: Always change the correct comment when changing to mill syntax in Scala CLI scripts tgodzik
  • bugfix: Correctly index semanticdb when reconnecting to sbt BSP server tgodzik
  • bugfix: Don't backtick soft keywords in select position of statements jkciesluk
  • bugfix: Properly backtick types when needed kasiaMarek
  • bugfix: Fix semantic highlight in files starting with annotation jkciesluk
  • bugfix: Show hover when cursor is right after symbol jkciesluk
  • improvement: Provide extension method code completions when typing xxx.@@Mee-Tree
  • bugfix: properly index all toplevel given (kasiaMarek)
  • bugfix: Argument completions for case class in apply calls (jkciesluk)
  • improvement: Add semantic highlight for docstring (jkciesluk)
  • bugfix: Improve indexing of regions based on indentation (jkciesluk)
  • bugfix: Fix issues with worksheets using outdated dependencies kasiaMarek
  • bugfix: Use relative uri for interactive java TextDocument when browsing Java sources from dependencies (Arthurm1)
  • bugfix: Fix reversed version order in dep completions in scala 2 jkciesluk
  • improvement: Use semantic highlight for using directives (jkciesluk)
  • bugfix: Fix semantic highlight for named arguments in Scala 2 (jkciesluk)
  • bugfix: Shorten dependency diagnostic ranges for scala-cli (LaurenceWarne)
  • bugfix: Scala 3 fix override completions starting w/ def (kasiaMarek)
  • bugfix: Properly index vals in constructors (kasiaMarek)
  • bugfix: Index cases for enum (kasiaMarek)
  • bugfix: Don't show import completions with case class members (jkciesluk)
  • improvement: Refactor type completions to provide both type symbol and object (kasiaMarek)
  • bugfix: Check parent docs even when class is indexed (Arthurm1)
  • improvement: Properly restart sbt server #5340 (kasiaMarek)
  • improvement: Check if possible java home is a correct path (tgodzik)
  • bugfix: find correctly symbols for type companion objects (kasiaMarek)
  • feat: make sure we capture .config/mill-version for Mill builds (ckipp01)
  • chore: Update default Bloop to 1.5.8 tgodzik
  • bugfix: Peovide textDocument/documentSymbol for scripts (kasiaMarek)
  • bugfix: backup old log files when too long (kasiaMarek)
  • bugfix: Fix scala-cli dependency completions for scala-cli 1.0.1 (jkciesluk)
  • improvement: Dependency version completions for scala native (jkciesluk)
  • fix: Correctly sort params in markdown (jkciesluk)
  • improvement: Add error reports upon compiler access error kasiaMarek

Contributors

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

$ git shortlog -sn --no-merges v0.11.12..v1.0.0
55 Tomasz Godzik
40 Katarzyna Marek
32 Jakub Ciesluk
5 Chris Kipp
5 doofin
4 Arthur McGibbon
3 rochala
2 Laurence Warne
2 eason du
1 Alexandre Archambault
1 Brice Jaglin
1 Dmitry Polchinsky
1 Ethan Atkins
1 Lorenzo Gabriele
1 Mehdi Massoudi
1 Panov Ivan
1 adpi2

Merged PRs

v1.0.0 (2023-07-12)

Full Changelog

Merged pull requests: