Metals
Scala 3 and Metals - a match made in heaven
Tomasz Godzik
Agenda
1. Introduction
2. metals - What is it?
3. build tools
4. Scala 3 compiler
5. Current Scala 3 features
6. Optional braces improvements
7. Some demos
8. Recent work
9. Questions
Why am I Here?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
Why am I Here?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619432/scalacenter.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
Why am I Here?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619432/scalacenter.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
Why am I Here?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619434/metals.png)
Currently working on Metals as one of the main contributors as a part of the collaboration between VirtusLab and Scala Center.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619432/scalacenter.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
Who Contributed to what metals is today?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9062049/Peek_2021-10-28_15-30.gif)
What is metals
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619434/metals.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9551160/pasted-from-clipboard.png)
created by Ólafur Páll Geirsson while working at scala center
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619782/olafur.jpeg)
SCALAMETA + LS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619434/metals.png)
not your standard IDE
WORKS DIRECTLY WITH THE BUILD TOOL
uses WIDELY ADAPTED LSP PROTOCOL
uses LSP + extensions to provide support in any editor
focus on the language support
![](https://media3.giphy.com/media/VbnUQpnihPSIgIXuZv/giphy.gif)
Your favourite language in you favourite Editor
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619858/vscode.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619867/vim.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619871/emacs.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619875/sublime.png)
Build tools
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9547509/pasted-from-clipboard.png)
Build tools
![](https://media2.giphy.com/media/Plg469Oxmig6lowyVM/giphy.gif)
The universe of Build tools
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620027/sbt.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620026/maven.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620025/gradle.png)
Mill
The universe of Build tools
Mill
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620027/sbt.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620026/maven.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620025/gradle.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/7210391/pasted-from-clipboard.png)
Metals
The universe of Build tools
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620027/sbt.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620026/maven.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620025/gradle.png)
Metals
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619434/metals.png)
Mill
The build server protocol
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9065534/Selection_113.png)
single instance running on your machine
Jited Scala compiler
uses zinc incremental compiler
worked on by the same team as Metals
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620029/impure-logo-bloop.png)
Bloop
recently updated to newest zinc
a number of Scala 3 issues fixed
should work well with all the supported tools
Bloop
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9547299/pasted-from-clipboard.png)
Standalone build server
numerous ways of using the build tools
![](https://media3.giphy.com/media/fYwuzOT53K7K4XLIq4/giphy.gif)
using Bloop from generated configuration
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620027/sbt.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620029/impure-logo-bloop.png)
- can generate configuration files for Bloop Build server
- standalone server <- probably best supported aside Bloop
- supports Scala 3
Mill
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620029/impure-logo-bloop.png)
- can generate configuration files for Bloop Build server
- standalone server
- SUPPORTS SCALA 3
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620026/maven.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620029/impure-logo-bloop.png)
- can generate configuration files for Bloop Build server
- fastest config generation
- SUPPORTS SCALA 3
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620025/gradle.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620029/impure-logo-bloop.png)
- can generate configuration files for Bloop Build server
- SUPPORTS SCALA 3 from 7.3 version
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620025/gradle.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6620029/impure-logo-bloop.png)
- can generate configuration files for Bloop Build server
- SUPPORTS SCALA 3 from 7.3 version
- also updated Zinc support in gradle 7.5!
GET STARTED WITH scala 3
New CLI tool to work with Scala
Not only 3!
Support for Native and JS
Seamless, friction less experience
DEMO!
![](https://media3.giphy.com/media/SLL8Dvv9Niwacz8Rnw/giphy.gif)
SCALA 3 COMPILER
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9547498/pasted-from-clipboard.png)
Interactive features
things that need to work with broken code
new challenges related to optional braces
hover/definition/completions/selection etc.
![](https://media0.giphy.com/media/LmBsnpDCuturMhtLfw/giphy.gif)
Presentation compiler
not your usual compiler
main difference is that it allows for errors
run until the typer
reimplemented for Scala 3
used initially for the Dotty language server
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9548936/wrong2.gif)
Presentation compiler
or why it's a match made in heaven
constant COOPERATION with the compiler team
pushing fixes into to the compiler
the compiler team helps out fixing their own
Great help from Martin Odersky!
![](https://media4.giphy.com/media/5pUAw9XjALuWepcOgV/giphy.gif)
well tested and fast to deploy
Support for each new Scalaversion available before announcement
we are Testing nightlies
And we add support for all the most recent nightlies in the prerelease version
![](https://media3.giphy.com/media/Qt4rpHuniwqKQ/giphy.gif)
History of one fix
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9549659/pasted-from-clipboard.png)
This is a lot of help
![](https://media3.giphy.com/media/j2jQZcPa5GiKSg7S6H/giphy.gif)
fixes both issues with error reporting and presentation compiler
close broken code in a smaller leaf
we can ignore that leaf
Before the fix
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9549632/before-broken.gif)
after the fix
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9549638/after-broken.gif)
the future
we are still ironing things out
Report any issues you encounter
You can also finding existing ones in Metals with Scala 3 label or in dotty with area:ide label
![](https://media0.giphy.com/media/AvMJCeu1EMmhG/giphy.gif)
the future continued
better support of multiple non compiling files?
numerous ideas
probably start with Scala 3
![](https://media0.giphy.com/media/AvMJCeu1EMmhG/giphy.gif)
Scala 3 features
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9547518/pasted-from-clipboard.png)
Current Scala 3 features
if something is not working it means we are working on it!
![](https://media4.giphy.com/media/Qc6oDLMbUrrVSUOPcP/giphy.gif)
Interactive features
completions
New completions:
-
keyword completions
-
named argument completions
-
scope completions in an empty line
-
match types!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9081483/completions-scala3.gif)
incoming
-
override completions
-
scaladocs
-
better signature help
hover
-
proper scaladocs shown
-
from parent if needed
-
correct shown in for comprehensions
-
properly shown extension methods
-
expression type on selection
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9081488/hover-scala3.gif)
Definition
uses information from semanticdb generated during compilation
fallback uses the compiler
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9081495/definition-scala3.gif)
index features
index features
they require full compilation for semanticdb to be produced
information provided by the build tool
special flag for Scala 3
New support for decorations in Scala 3!
References
uses semanticdb
needs compilation
responsive
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9081505/references-scala3.gif)
Renames
uses semanticdb
needs compilation
will rename all symbol overrides
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9081507/renames-scala3.gif)
code lenses
test explorer
go to implementation
type decorations
implicit parameters, classes, conversions
A lot more
dEMOS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9547531/pasted-from-clipboard.png)
Demos
SOME OF THE FEATURES might be AVAILABLE IN NIGHTIES
you can chose to use prerelease version
Might break from time to time
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9547452/switch-prerelease.gif)
Metals analyse
Can be used to:
-
decompile classfiles
-
show tasty
-
show semanticb
-
show javap
User experience improvements
-
simpler launching of programs
-
better doctor
-
more feedback for the user to show what is going on
-
lots more to improve!
test explorer
-
see all your tests with an ability to filter
-
run a subset of tests
-
better UX of matching results to tests
-
constantly improved
better library explorer
-
not yet merged
-
amazing work by Arthur McGibbon
-
virtual docs with breadcrumbs
-
easy way to navigate your dependencies
-
navigation and all other features working
-
automatic decompilation
Scala 3 debugger
-
still worked on
-
might be moved to the compiler
-
great work by @tdudzik
-
also working completions!
Bonus demo?
![](https://media1.giphy.com/media/xT0xeuOy2Fcl9vDGiA/giphy.gif)
Bonus demo?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9550692/pasted-from-clipboard.png)
Recent Work
- improved doctor
- create companion object
- better unapply signatures
- bloop settings
- better support for munit in test explorer
- improvements for Scala 3 support
NEWEST Metals FEATURES
https://scalameta.org/metals/blog/2022/04/26/aluminium
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9544428/pasted-from-clipboard.png)
What do we need to work on
more completions!
incremental improvements
better support between multiple non compiling files
![](https://media1.giphy.com/media/nCVVpakhBTwBi/giphy.gif)
Don't hestitate to sent us ideas
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/7190204/pasted-from-clipboard.png)
We do listen!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9078878/Selection_115.png)
Scala Days talk by Ólafur Páll Geirsson: https://tinyurl.com/metals-scala
Great in-depth explanation by Chris Kipp: https://tinyurl.com/metals-explained
Metals in vim
https://tinyurl.com/metals-vim
Intro to working with metals
https://tinyurl.com/metals-intro
Related Talks
Presentation: https://slides.com/tomekgodzik/metals-heaven
Metals documentation: https://scalameta.org/metals/
Reach out to me on Twitter: @TomekGodzik
OR
Ask me about anything on discord!
OR
Contact as at VirtusLab - we are doing really cool things with tooling
QUESTIONS?
Scala 3 and Metals - a match made in heaven
By Tomek Godzik
Scala 3 and Metals - a match made in heaven
- 149