Metals v1.3.0 - Thallium
We're happy to announce the release of Metals v1.3.0, which brings several big features and multiple bugfixes. One of the main things to take a look at is the Java home changes, let us know if it caused any issues for you! Another big change is the improved debugger, which is a fruit of a lot of hard work. As always we are striving to improve our stability, so if you notice an issues or any errors popping up in .metals/.reports do let us know!
Commits since last release | 132 |
Merged PRs | 105 |
Contributors | 16 |
Closed issues | 53 |
New features | 8 |
For full details: https://github.com/scalameta/metals/milestone/65?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
- Java Home improvements
- Automatic imports setting
- Preferred build server setting
- Inlay hints support
- Exhaustive matches for union types
- Debugger improvements
- Go to implementations for dependency sources
- Completions for implicit classes
- Plugin author changes
- Miscellaneous
New Scala versions support
Metals now supports 2.12.19
, 2.13.13
and 3.3.3
Scala versions. That
support was also back-ported to the previous Metals v1.2.2.
Starting with 3.3.5 version all newer Scala releases will not require specific support in Metals thanks to additional inclusions of presentation compiler module within the compiler.
Java Home improvements
Starting with this version of Metals, JDK used for running Metals and the one used for your project can now be separate. This allows us to simplify setting up JDK for running Metals, which will be automatically downloaded using coursier if not detected on your machine.
This means we have two settings for Java:
metals.javaVersion
- version of Java to be used for running Metal language server, used within Visual Studio Code. Users can choose from 11, 17 and 21. Java 8 is deprecated and will be dropped with the next release.metals.javaHome
- Java used for your project, Metals will try to add all the appropriate flags so that language features are consistent with the version of Java you are using. Will always support JDK 8 and higher.
Automatic imports setting
Thanks to keirlawson it's now possible to make
Metals automatically import any workspace. This takes a shape of a new setting
metals.autoImportBuild
which has three options:
off
- users will always be asked whether they want to import their workspace either initially or after changes.initial
- when users first open a new workspace Metals will automatically import the workspace, but will still ask about reimporting after changes.all
- Metals will always automatically import and reimport your workspace. This might make more sense when using other build tools than Bloop as it might take a while to run the import.
Preferred build server setting
Thanks to kasiaMarek it's now possible to
default to the BSP server instead of Bloop for all your workspaces using
metals.defaultBspToBuildTool
setting. This will work with Mill and sbt, which
support both.
Inlay hints support
After a huge amount of work by jkciesluk Metals will now use the standard LSP way of showing decorations via Inlay Hints instead of a custom solution. Thanks to this, the decorations behave much more naturally like usual code, you can navigate to definition and get proper hovers. It will also allow all editors to support decorations without implementing the additional extension to the protocol.
Additionally, together with inlay hints we reworked all the decoration settings to be included in a single object and two new ones were added:
metals.inlayHints.typeParameters.enable
- when this option is enabled, each place where a type parameter is applied has it displayed either as additional decorations if they are supported by the editor or shown in the hover.metals.inlayHints.hintsInPatternMatch.enable
- when this option is enabled, each place when a type is inferred in a pattern match has it displayed either as additional decorations if they are supported by the editor or shown in the hover.
There is a small issue within VS Code, which might be fixed in the future, and it makes it impossible to hover on multiple parts of a particular type consecutively. Users have to move the cursor away from the type and again onto the part of the type they want to learn more about.
Inlay hints will also not work 100% for any older deprecated Scala 2 versions and Scala 3 versions 3.4.0, 3.4.1, 3.3.0, 3.3.1, 3.3.2, 3.3.3. For those versions Metals uses a fallback that translates the older decorations to the new inlay hints, but without go to definition and hover.
Exhaustive matches for union types
Another great new feature done by jkciesluk enables users to get a suggestion that will complete a pattern match with all types within a union type.
Debugger improvements
The Scala debugger adapter library, which is responsible for providing debugging experience in Metals, has been released recently under v4.0.0 with a lot of great improvements. These include:
- Pretty stacktraces (Scala 3 Only) - improved stack trace names that are easier and more useful to read for the users.
- Runtime evaluator - allows evaluating Java-like expression in Scala and Java source files without using the compiler. It is faster, it can access private members, and it does not require casting to access members of runtime types.
- Hot-code replace - The hot-code replace feature allows to change the behavior of a running program. It is now possible to change the body of a method, and to reload it in the debugged program. After the hot-code replacement, any call to the modified method will execute the new implementation, even on former instances of the changed class. This feature is particularly useful to track a bug and fix it in a single debug session.
- Collapse skipped frames - the debugger indicated frames which are not useful for the users, Metals will now collapse them by default.
This all was done thanks to the hard work of adpi2, iusildra and other contributors.
You can read more on the v4.0.0 release page
Go to implementations for dependency sources
Previously, it was only possible to search for implementations inside dependencies as Metals didn't index type hierarchy. Thanks to kasiaMarek it's now possible to do that in both Scala and Java files with an exception of JDK to avoid additional cost of indexing it in every workspace. The latter will be fixed later on.
As with inlay hints, this feature will not work when using older deprecated Scala 2 versions and some of the older Scala 3 3.3.x and 3.4.x versions.
Completions for implicit classes
Another feature implemented by kasiaMarek is adding support for completions of old style extension methods that were declared within implicit classes. This will work similar to extensions method completions for Scala 3.
Plugin author changes
Doctor format version changed to 6 due to the added project Java information.
Miscellaneous
- bugfix: Fix insert position for auto imports in worksheets in Scala 3 jkciesluk
- bugfix: Show docs for classes with static members and scala objects tgodzik
- bugfix: Use text document version for initial package edit kasiaMarek
- bugfix: Fix restarting Bazel between CLI and Metals tgodzik
- improvement: Regenerate Bazel files if any are missing tgodzik
- bugfix: Don't calculate inlay hints with disabled synthetics jkciesluk
- improvement: Properly show when semanticdb is missing while using Bazel tgodzik
- improvement: Bump giter8 and make sure it gets updated automatically tgodzik
- bugfix: Fix document highlight on simple extension method jkciesluk
- bugfix: Fix parsing of enum in DAP messages adpi2
- bugfix: Don't show unhelpful renames in hover jkciesluk
- bugfix: workaround for missing line number in qdox java record fields kasiaMarek
- bugfix: make symbol search prefer results with scala version of document in focus kasiaMarek
- improvement: Better inlay Hints for anonymous implicits jkciesluk
- improvement: Unify connecting to bazelbsp with other build servers jkciesluk
- bugfix: emit as extension method if member of implicit class with val in constructor kasiaMarek
- improvement: Check if compiled unit is available before using tgodzik
- improvement: Remove Bazel specific directories when running full clean tgodzik
- improvement: Allow running organize imports on scripts tgodzik
- bugfix: fix worksheets with
3.4.0
kasiaMarek - bugfix: Fix issues with bazelmod alongside WORKSPACE tgodzik
- bugfix: go to implementations for multi-module projects kasiaMarek
- improvement: Request jvmRunEnvironment lazily tgodzik
- improvement: Use dependencyModule for resolving sources tgodzik
- improvement: support "behavior of" syntax in ScalaTest's FlatSpec style piter75
- bugfix: Don't ask for override completions on null type jkciesluk
- bugfix: Add additional check for InterpolatorSplice substring jkciesluk
- bugfix: Case completions in summonFrom jkciesluk
- fix: take last change in
didChange
kasiaMarek - improvement: Simplify resolving presentation compiler tgodzik
- improvement: turn off formatting for
metals.sbt
kasiaMarek - improvement: add timeout to worksheet evaluation kasiaMarek
- improvement: add project's java info to doctor kasiaMarek
- bugfix: allow for mixed multiple custom and known build servers kasiaMarek
- improvement: Also start Scala CLI if the focused file was Scala and no build tool is available. tgodzik
- bugfix: CompletionPosition inferStart should not crash jkciesluk
- fix: check that implicit method owner is static in completions kasiaMarek
- bugfix: Incorrect position in import missing symbol jkciesluk
- bugfix: Arg completions on null symbol in Scala 2 jkciesluk
- bugfix: Incorrect inlay hints inside quotes jkciesluk
- improvement: Expand Selection in comments for Scala 2 doofin
- bugfix: deduplicate auto connect for scala-cli kasiaMarek
- fix: don't remove package when target outside of root kasiaMarek
Contributors
Big thanks to everybody who contributed to this release or reported an issue!
$ git shortlog -sn --no-merges v1.2.2..v1.3.0
33 Jakub Ciesluk
31 Tomasz Godzik
26 Katarzyna Marek
8 Keir Lawson
5 Scalameta Bot
4 scalameta-bot
4 tgodzik
3 Adrien Piquerez
3 dependabot[bot]
2 Lucas Nouguier
2 adpi2
1 Alex Boisvert
1 Chris Kipp
1 Jędrzej Rochala
1 Piotr Szczepanik
1 eason du
Merged PRs
v1.3.0 (2024-04-15)
Merged pull requests:
- refactor: use Quotes symbol instead of full name #6308 (kasiaMarek)
- bugfix: deduplicate auto connect for scala-cli #6259 (kasiaMarek)
- fix: don't remove package when target outside of root #6299 (kasiaMarek)
- tests: filter out
java.lang.classfile
for JDK 22 #6298 (kasiaMarek) - chore: Remove test workspace, which isn't really used #6302 (tgodzik)
- chore: Improve Bazel navigation message #6300 (tgodzik)
- Expand Selection in comments for Scala 2 #6109 (doofin)
- bugfix: Incorrect inlay hints inside quotes #6225 (jkciesluk)
- bugfix: Arg completions on null symbol in Scala 2 #6244 (jkciesluk)
- bugfix: Incorrect position in import missing symbol #6221 (jkciesluk)
- fix: check that implicit method owner is static in completions #6286 (kasiaMarek)
- chore: Test Metals with newest Bloop #6276 (tgodzik)
- chore: Update test groups #6287 (tgodzik)
- bugfix: CompletionPosition inferStart should not crash #6247 (jkciesluk)
- improvement: New inlay hints options #6236 (jkciesluk)
- chore: Add all repos when resolving bazel #6282 (tgodzik)
- improvement: Also start Scala CLI if the focused file was Scala #6281 (tgodzik)
- bugfix: allow for mixed multiple custom and known build servers #6273 (kasiaMarek)
- test: fix JDK version test #6279 (kasiaMarek)
- improvement: don't index type hierarchy in JDK sources #6278 (kasiaMarek)
- chore: Ignore tests that are also ignored in nightly #6277 (tgodzik)
- test: increase timeout on worksheet inf loop test #6275 (kasiaMarek)
- chore: Update scalameta to 4.9.3 #6254 (tgodzik)
- improvement: add project's java info to doctor #6226 (kasiaMarek)
- build(deps): bump @docusaurus/core from 3.1.1 to 3.2.0 in /website #6267 (dependabot[bot])
- Minor documentation fix for suggested command in mill.md #6270 (aboisvert)
- chore: ignore
import-missing-symbol
for3.4.1
#6264 (kasiaMarek) - improvement: handle java home setting #6204 (kasiaMarek)
- improvement: add timeout to worksheet evaluation #6262 (kasiaMarek)
- feat: index type hierarchy in java files #6189 (kasiaMarek)
- improvement: turn off formatting for
metals.sbt
#6260 (kasiaMarek) - improvement: Simplify resolving presentation compiler #6258 (tgodzik)
- Collapse skipped frames #6240 (adpi2)
- bugfix: fix table name #6255 (kasiaMarek)
- fix: take last change in
didChange
#6237 (kasiaMarek) - chore: Don't log error if we can resolve stable PC #6248 (tgodzik)
- bugfix: Case completions in summonFrom #6241 (jkciesluk)
- bugfix: Hover on not assigned type #6242 (jkciesluk)
- bugfix: Don't call tail on empty list #6243 (jkciesluk)
- bugfix: Add additional check for InterpolatorSplice substring #6245 (jkciesluk)
- bugfix: Don't ask for override completions on null type #6246 (jkciesluk)
- improvement: support "behavior of" syntax in ScalaTest's FlatSpec style #6235 (piter75)
- improvement: Use dependencyModule for resolving sources #6213 (tgodzik)
- improvement: Request jvmRunEnvironment lazily #6223 (tgodzik)
- chore: unignore tests after backport #6227 (kasiaMarek)
- bugfix: go to implementations for multi-module projects #6211 (kasiaMarek)
- bugfix: Fix issues with bazelmod alongside WORKSPACE #6224 (tgodzik)
- bugfix: fix worksheets with
3.4.0
#6212 (kasiaMarek) - improvement: Allow running organize imports on scripts #5942 (tgodzik)
- improvement: Remove bazel specific directories when running full clean #6205 (tgodzik)
- tests: add tests for pc
info
#6198 (kasiaMarek) - improvement: Check if compiled unit is available before using #6216 (tgodzik)
- build(deps): Update cli_3, scala-cli-bsp from 1.1.3 to 1.2.0 #6210 (scalameta-bot)
- bugfix: emit as extension method if member of implicit class with val in constructor #6190 (kasiaMarek)
- chore: Update Ammonite and it's suported Scala versions in tests #6217 (tgodzik)
- chore: Adjsut inlay hints results for Scala CLI tests #6215 (tgodzik)
- chore: Bump scalameta and scalafix #6199 (jkciesluk)
- improvement: Unify connecting to bazelbsp with other build servers #6164 (jkciesluk)
- improvement: Better inlay Hints for anonymous implicits #6176 (jkciesluk)
- bugfix: make symbol search prefer results with scala version of document in focus #6200 (kasiaMarek)
- Fix CI to make up for latest changes in dotty #6181 (rochala)
- chore: unignore tests for backported changes #6197 (kasiaMarek)
- bugfix: completions for implicit methods #6156 (kasiaMarek)
- build(deps): bump coursier/setup-action from 1.3.4 to 1.3.5 #6185 (dependabot[bot])
- build(deps): bump hmarr/auto-approve-action from 3 to 4 #6186 (dependabot[bot])
- chore: Add support for Scala 3.3.3 #6179 (tgodzik)
- build(deps): Update scala-debug-adapter from 4.0.1 to 4.0.2 #6183 (scalameta-bot)
- chore: Unignore macro tests #6175 (tgodzik)
- fix: workaround for missing line number in qdox java record fields #6177 (kasiaMarek)
- Trigger HCR after compilation #5578 (iusildra)
- bugfix: Don't show unhelpful renames in hover #6173 (jkciesluk)
- chore: Change to slf4j2 to avoid too much logging in flyway #6174 (tgodzik)
- Improve debug information about reference provider #6170 (tgodzik)
- chore: Remove code causing warnings #6169 (tgodzik)
- improvement: Add fallback for inlay hints #6142 (jkciesluk)
- build(deps): Update sbt, scripted-plugin from 1.9.8 to 1.9.9 #6163 (scalameta-bot)
- feature: go to implementations for dependency sources #5623 (kasiaMarek)
- Add support for Scala 2.13.13 #6162 (tgodzik)
- build(deps): Update scalafmt-core from 3.7.17 to 3.8.0 #6159 (scalameta-bot)
- build(deps): Update xnio-nio from 3.8.12.Final to 3.8.13.Final #6158 (scalameta-bot)
- chore: Add support for Scala 2.12.19 #6154 (tgodzik)
- Fix parsing of enum in DAP messages #6151 (adpi2)
- bugfix: Document highlight on simple extension method #6152 (jkciesluk)
- feat: add setting to choose preferred build server #6121 (kasiaMarek)
- improvement: Match completions on union types #6129 (jkciesluk)
- improvement: Bump giter8 and make sure it gets updated automatically #6147 (tgodzik)
- improvement: Show semanticdb missing when using Bazel #6145 (tgodzik)
- bugfix: Don't calculate inlay hints with disabled synthetics #6141 (jkciesluk)
- improvement: Regenerate Bazel files if any are missing #6143 (tgodzik)
- Add Helix to sidebar #6140 (keirlawson)
- Add Helix documentation #6100 (keirlawson)
- refactor: generate mill BSP file with
--jobs 0
#6139 (ckipp01) - bugfix: Fix restarting bazel #6132 (tgodzik)
- bugfix: use text document version for initial package edit #6128 (kasiaMarek)
- feature: Replace synthetic decorations with inlay hints #5983 (jkciesluk)
- build(deps): Update cli_3, scala-cli-bsp from 1.1.2 to 1.1.3 #6138 (scalameta-bot)
- bugfix: Show docs for classes with static members and scala objects #6133 (tgodzik)
- chore: Add support for Scala 3.3.2 #6122 (tgodzik)
- build(deps): Update scala-debug-adapter from 3.1.6 to 4.0.1 #6123 (scalameta-bot)
- build(deps): Update ujson from 3.1.4 to 3.1.5 #6125 (scalameta-bot)
- bugfix: Auto imports in worksheets in Scala 3 #6042 (jkciesluk)
- Auto import builds option #6064 (keirlawson)
- build(deps): Update protobuf-java from 3.25.2 to 3.25.3 #6124 (scalameta-bot)
- chore: Add 1.2.2 release notes #6119 (jkciesluk)
- docs: Add warning about Bazel 7.0.0 and add bazel to sidebar #6120 (tgodzik)