Metals v0.10.0 - Tungsten
We're happy to announce the release of Metals v0.10.0, which is the first
release in the "Tungsten" line. In 0.10.x
we will focus on polishing existing
features, fixing bugs and improving the Scala 3 support at least to the level of
Scala 2. This will pave the way towards the 1.0.0
release later this year.
Commits since last release | 163 |
Merged PRs | 79 |
Contributors | 14 |
Closed issues | 30 |
New features | 12 |
For full details: https://github.com/scalameta/metals/milestone/34?closed=1
Metals is a language server for Scala that works with VS Code, Vim, Emacs, Sublime Text and Eclipse. 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!
- Support for Scala 2.13.5.
- Type decorations for definitions.
- Insert inferred type refactoring.
- Configuration option for the default Scala version.
- Code lens to easily discover the copy worksheet command.
- Improved short names when importing.
- Debug run/test when using sbt via BSP.
- [Scala 3] Support for Scala 3.0.0-RC1
- [Scala 3] Filtering and sorting for completions.
- [Scala 3] Basic shorter signature support for hover.
- [Scala 3] Document outline
- [Scala 3] Code folding
- [Scala 3] Formatting
|
in multiline string - [Scala 3] Code action to convert to multiline string.
- [Scala 3] Dependency sources navigation
Type decorations for definitions.
One of the most requested features for Metals was the ability to show the inferred type for anything that does not have it defined explicitly. This includes the type at:
- value and variable definitions
val a = 1
var b = 2
- method definitions
def method() = ""
- variables in pattern matches
list match {
case aa :: tail =>
}
- lambda parameters
list.map(param => param.toInt)
- for comprehensions
for(i <- 0 to 10)`
The decoration is based on the information produced during the compilation, so anything new will first need to be compiled to have the type shown.
This feature can easily be controlled by the previously available
metals.showInferredType
setting and will currently work for clients that allow
virtual decoration to be inserted into existing text. Those clients currently
include Visual Studio Code, Emacs and Sublime Text (after merging this
PR).
Insert inferred type refactoring.
Another highly requested feature and closely related to the type decorations is
the ability to automatically insert type annotation. This is achieved using a
new Insert type annotations
and
Insert type annotation into pattern definition
refactor code actions. Those
actions work in the same places as mentioned in the previous point - method,
variables, lambdas etc. - but use the presentation compiler instead of indexes.
What it means is that this new feature will work even in some more problematic
cases when the file is not yet compiled or in files where type decorations are
not yet supported, like in worksheets.
There might be still some work to do when it comes to some more complicated types, but it should work perfectly well for most daily use cases. Please do report any issues you might encounter, as it will help us greatly to polish this new feature.
Configuration option for default Scala version.
Previously, for any standalone files Metals would use the default Scala version
2.12.13. This changed in v0.10.0
and can either be defined with a setting:
"metals.fallbackScalaVersion" : "3.0.0-RC1"
or when the setting is empty or set to automatic
Metals will infer the Scala
version automatically from the project, which will be the highest Scala version
used in the project.
Code lens for copy worksheet command.
In the previous version 0.9.8
a new command was added to Metals that allows
clients to export the worksheet output for the users to easily share their
results. This however was not easy to discover for a large chunk of the users,
which is why the command is also now available by using the code lens at the top
of a worksheet file. This will work for any clients that support the
copy-worksheet-output
command.
Debug run/test when using sbt via BSP.
Thanks to the great work of @adpi2 and @er1c on the scala-debug-adapter Metals now supports debugging when using sbt BSP. The experience should be almost the same as when using Bloop, since the new library reuses the already existing Bloop implementation and will be a standard to use for BSP servers.
To use sbt as a BSP server users still need to use metals.bsp-switch
command,
which will take care of setting up everything and adding the appropriate
plugins.
More information about sbt and BSP can be found in the previously published blogpost.
[Scala 3] Support for Scala 3.0.0-RC1
Scala 3.0.0-RC1
has just been released and it's the first release that starts
us on the way towards the full Scala 3 release. Syntax is now stable and the
compiler team will now focus on fixing existing issues and polishing the
internals.
This is a perfect opportunity to try out Scala 3 alongside Metals and see all the new and interesting features that the language has to offer as well as report any issues.
[Scala 3] Filtering and sorting for completions.
In previous versions of Metals, the completions offered by the language server would just be a list of what is available in the current scope. This however did not provide the best possible experience to the users. Thanks to work by @sellophane those initial results are now filtered and sorted so that the most useful methods and values will be available first.
[Scala 3] Basic shorter signature support for hover.
Together with better completions we also included a better way to display types on hover. Previously, we would always display the full class name with the package prefix, which would mean that some methods could look quite complicated for example:
def method(first: alpha.beta.gamma.DType, second: alpha.beta.gamma.DType)
Thanks to @tanishiking we no longer display the long type for anything that is already imported into scope. So the above method would look like:
def method(first: DType, second: DType)
This needs to be further improved by shortening some of the symbols that are not imported into scope and we still need to apply the same optimization in other places where the type is displayed.
[Scala 3] Parser-based features for Scala 3
Under the hood Metals uses a separate parser implementation that can be found in scalameta and it supports numerous different Scala versions. Thanks to the recent work on supporting Scala 3, we now have a dialect that should parse the Scala 3 syntax correctly on par with 3.0.0-RC1 version.
This parser is used by Metals to provide a number of different features, that should now work correctly for Scala 3:
- document outline which shows the map for the current source file and can also be searched, which is useful to locate a particular method or value in the current document.
- folding ranges which enables users to hide parts of their code.
- automatic management of pipes in multiline string.
- code action to convert simple string into multiline string.
- go to definition in Scala 3 dependency sources.
Last mentioned feature together with recently added on-demand semanticdb index generation enables users to properly navigate Scala 3 dependency sources.
A lot of the great work here was done by dos65.
Miscellaneous
- Fix default version of Scala given to Ammonite.
- Fix issues when method with implicit symbols would be wrongly renamed.
- Fix issues with stack trace in debugging not showing the correct path,
- Fix issue when breakpoints in multiple files would not work together.
- Ensure Bloop isn't offered as a server in an unsupported workspace.
- Wait for compilation to finish before starting debug session.
- Fix references to work properly in standalone files and dependency sources.
- Fix memory leak in presentation compiler.
- Fix issues where created files should use back quotes.
- Rename and references now work for worksheets and sbt files - thanks dos65!
- Always try to have the shortest path when automatically importing symbols.
- Fix issues with shadowed symbols being imported incorrectly.
- Fixed go to definition for Scala 3 sources.
Contributors
Big thanks to everybody who contributed to this release or reported an issue!
$ git shortlog -sn --no-merges v0.9.10..v0.10.0
Tomasz Godzik
Chris Kipp
Vadim Chelyshov
Adrien Piquerez
ag91
Rikito Taniguchi
Arthur McGibbon
Ayoub Benali
Błażej Kardyś
Eric K Richardson
Lorenzo Gabriele
Meriam Lachkar
Pavol Vidlicka
strobe
Merged PRs
v0.10.0 (2021-02-24)
Merged pull requests:
- Add support for Scala 2.13.5 #2544 (tgodzik)
- DocumentSymbolProvider: set name as " " in case if it's empty. #2545 (dos65)
- Fix rename/references for worksheets #2539 (tgodzik)
- [Scala 3] Add an ability to generate on-demand semanticdb #2538 (tgodzik)
- Fix standalone Scala 3 worksheets #2531 (tgodzik)
- Update scalameta to newest snapshot #2528 (tgodzik)
- Fallback to Scala3 dialects when parsing library sources #2527 (tgodzik)
- add explanation on how to annotate stack traces for Emacs #2516 (ag91)
- Add support for Scala 3.0.0-RC1 #2524 (tgodzik)
- Basic shorter signature support for hover in Scala3 #2504 (tanishiking)
- Integration of sbt-debug-adapter #2523 (adpi2)
- [Scala 3] Add filtering and sorting for completions #2487 (sellophane)
- Improve short names when importing #2497 (tgodzik)
- Upgrade to Bloop 1.4.7 + remove -J prefix #2522 (adpi2)
- Revert to recently focused document if the current one was immediately closed #2519 (tgodzik)
- Add Windows log locations to docs #2521 (Arthurm1)
- Revert https://github.com/scalameta/metals/commit/519c6414797edcc35d5d714b220c7d7d140c4b4 #2518 (ckipp01)
- Don't populate completion detail if it's an empty string. #2514 (ckipp01)
- Fix issues where created files should use backticks #2503 (tgodzik)
- Update scalameta and fix tests that include Scala 3 givens #2515 (tgodzik)
- Update mdoc_2.12, sbt-mdoc to 2.2.17 #2512 (scala-steward)
- Update mdoc-interfaces to 2.2.17 #2511 (scala-steward)
- Update flyway-core to 7.5.3 #2510 (scala-steward)
- Update jna, jna-platform to 5.7.0 #2509 (scala-steward)
- Update undertow-core to 2.2.4.Final #2508 (scala-steward)
- Update coursier to 2.0.11 #2507 (scala-steward)
- Update scribe, scribe-file, scribe-slf4j to 3.3.3 #2506 (scala-steward)
- Update bloop-config, bloop-launcher to 1.4.6-40-6418e91f #2505 (scala-steward)
- Only set focusedDocument on
didOpen
without didFocusProvider #2501 (tgodzik) - Add few emacs config performance tuning tips to docs/editors/emacs.md #2492 (strobe)
- Add insert inferred type code action #2490 (tgodzik)
- Add support for new Scala 3 syntax in document outline. #2448 (dos65)
- Remove unused val that may cause null pointer exceptions #2486 (tgodzik)
- A bit of refactoring around BSP connection and Build Import. #2481 (ckipp01)
- Add code lens to easily discover copy worksheet command #2470 (tgodzik)
- Try to fix memory leak in presentation compiler #2476 (tgodzik)
- Fix TreeViewLspSuite #2477 (tgodzik)
- Include the element in the version #2472 (ekrich)
- Add in part one of a metals retrospective blog post #2469 (ckipp01)
- Update the doctor docs in client commands #2468 (ckipp01)
- Fix issues with references in standalone files #2467 (tgodzik)
- Fix printed inferred type for complex types #2449 (tgodzik)
- Fallback Scala version - filter out
automatic
value #2466 (dos65) - Wait for compilation to finish before starting debug session #2233 #2450 (pvid)
- Pass URI to
semanticdbTextDocument
method and fix possible issues #2465 (tgodzik) - Remove dependency on io.methvin:directory-watcher. #2464 (ckipp01)
- Update scribe, scribe-slf4j to 3.3.1 #2457 (scala-steward)
- Update sbt-dotty to 0.5.2 #2452 (scala-steward)
- Update sbt, scripted-plugin to 1.4.7 #2461 (scala-steward)
- Update mdoc-interfaces, mdoc_2.12, sbt-mdoc to 2.2.16 #2462 (scala-steward)
- Update ujson to 1.2.3 #2456 (scala-steward)
- Update pprint to 0.6.1 #2455 (scala-steward)
- Update bloop-config, bloop-launcher to 1.4.6-33-1c6f6712 #2453 (scala-steward)
- Update flyway-core to 7.5.2 #2460 (scala-steward)
- Update munit, munit-docs, sbt-munit to 0.7.21 #2463 (scala-steward)
- Update coursier to 2.0.9 #2458 (scala-steward)
- Add configuration option for default Scala version #2417 (dos65)
- Minor adjustements to type decorations #2447 (tgodzik)
- Add support for type decorations in for comprehensions and patterns #2446 (tgodzik)
- Add type decorations for definitions #2435 (tgodzik)
- Update docs on system-properties and inline decorations. #2444 (ckipp01)
- Correct dialect for standalone scripts. #2445 (ckipp01)
- Make
munitBucketName
a global setting #2443 (tgodzik) - Fix vscode.md (find-java-home has replaced by locate-java-home in metals-vscode v1.1.0) #2441 (tanishiking)
- Change bucket name to the non default one #2440 (tgodzik)
- Minor fix: remove unused parameter #2438 (dos65)
- Add rename and references for sbt files #2412 (dos65)
- Ensure Bloop isn't offered as a server in an unsupported workspace. #2428 (ckipp01)
- Provide a more specific error message when scalafix fails organizing imports #2421 (mlachkar)
- Fix issue with breakpoints in multiple files #2434 (tgodzik)
- Update editor overview doc (sublime) #2433 (ayoub-benali)
- Search also transitive sources when falling back from symbol search #2427 (tgodzik)
- Prepend
_empty_/
when searching for symbol without a package #2426 (tgodzik) - Implicit symbol rename fix #2422 (dos65)
- Use scalameta parser dialect Scala3 for Scala 3 sources #2374 (tgodzik)
- Display link correctly in docs #2416 (lolgab)
- Update sbt-launch.jar. #2399 (ckipp01)
- Fix default version of Scala given to Ammonite. #2411 (ckipp01)
- Add release notes for v0.9.10 #2410 (tgodzik)