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?

Why am I Here?


Why am I Here?


Why am I Here?

Currently working on Metals as one of the main contributors as a part of the collaboration between VirtusLab and Scala Center.


Who Contributed to what metals is today?

What is metals


created by Ólafur Páll Geirsson while working at scala center

SCALAMETA + LS

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

Your favourite language in you favourite Editor




Build tools

Build tools

The universe of Build tools



Mill
The universe of Build tools
Mill




Metals
The universe of Build tools



Metals

Mill
The build server protocol

single instance running on your machine
Jited Scala compiler
uses zinc incremental compiler
worked on by the same team as Metals

Bloop
recently updated to newest zinc
a number of Scala 3 issues fixed
should work well with all the supported tools
Bloop

Standalone build server
numerous ways of using the build tools

using Bloop from generated configuration


- can generate configuration files for Bloop Build server
- standalone server <- probably best supported aside Bloop
- supports Scala 3
Mill

- can generate configuration files for Bloop Build server
- standalone server
- SUPPORTS SCALA 3


- can generate configuration files for Bloop Build server
- fastest config generation
- SUPPORTS SCALA 3


- can generate configuration files for Bloop Build server
- SUPPORTS SCALA 3 from 7.3 version


- 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!

SCALA 3 COMPILER

Interactive features
things that need to work with broken code
new challenges related to optional braces
hover/definition/completions/selection etc.

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

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!

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

History of one fix

This is a lot of help

fixes both issues with error reporting and presentation compiler
close broken code in a smaller leaf
we can ignore that leaf
Before the fix

after the fix

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

the future continued
better support of multiple non compiling files?
numerous ideas
probably start with Scala 3

Scala 3 features

Current Scala 3 features
if something is not working it means we are working on it!

Interactive features
completions
New completions:
-
keyword completions
-
named argument completions
-
scope completions in an empty line
-
match types!

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

Definition
uses information from semanticdb generated during compilation
fallback uses the compiler

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

Renames
uses semanticdb
needs compilation
will rename all symbol overrides

code lenses
test explorer
go to implementation
type decorations
implicit parameters, classes, conversions
A lot more
dEMOS

Demos
SOME OF THE FEATURES might be AVAILABLE IN NIGHTIES
you can chose to use prerelease version
Might break from time to time

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?

Bonus demo?

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

What do we need to work on
more completions!
incremental improvements
better support between multiple non compiling files

Don't hestitate to sent us ideas

We do listen!

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
- 547