Simple tooling for scala 3
Metals, scalacli
Tomasz Godzik
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/7448759/pasted-from-clipboard.png)
Who am i
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
Tomasz Godzik
Senior Scala Developer
Who am i
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
Tomasz Godzik
Senior Scala Developer
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619432/scalacenter.png)
previously
contributor for Scala Center
Who am i
-
mdoc
-
metals
-
scalameta
-
dotty
-
bloop
-
various commercial projects
Who am i
![](https://media4.giphy.com/media/IelxugxenjdyU/giphy.gif)
-
mdoc
-
metals
-
scalameta
-
dotty
-
bloop
-
various commercial projects
my company
We provide expert software engineering & consultancy services to give our clients a competitive edge
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/6619438/virtuslab.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/7210784/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9823117/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9823121/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9823123/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9823127/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9823133/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9823136/pasted-from-clipboard.png)
agenda
1. Introduction
2. what is simple tooling
3. scalacli
4. scalacli demos
5. metals
6. Metals demos
7. questions
Why does it matter ?
Simple tooling
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9931981/pasted-from-clipboard.png)
COMPLICATED SETUP AND TOOLS
promote people who can better deal with the setup and not actual business features
you hire people to do a specific task, not fight with the tools
![](https://media2.giphy.com/media/14pUUmCj9ysy6A/giphy.gif)
- reduce burnout
- INCREASE PRODUCTIVITY
- retain people
- promote the language (scala)
Simple tools
what makes a tool simple?
![](https://media2.giphy.com/media/xT0xeuOy2Fcl9vDGiA/giphy.gif)
Frictionless
Frictionless
?
?
?
?
?
?
?
?
the most basic requirement
people need to know that can easily find your website and instructions
whether corporate or open source
EASY TO FIND
![](https://media4.giphy.com/media/26n6WywJyh39n1pBu/giphy.gif)
one simple way
VS
multiple known ways supported (deb, brew, exe)
EASY TO install
![](https://brew.sh/assets/img/homebrew-256x256.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9819595/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9819597/pasted-from-clipboard.png)
should be quick
fine to have longer tasks, but they should fail quickly
User should not need to iterate dozens of coffee breaks
Responsive
![](https://imgs.xkcd.com/comics/compiling.png)
Hard to achive
improve continuously
there is a reason there are dedicated people for it
ideally things should be easy to learn, easy to master
user experience
![](https://media2.giphy.com/media/0IAPszdB8MMjPxNhFL/giphy.gif)
last, not least
Many different ways:
- cookbooks
- IM
- issues
Side note:
- triage - not everything needs immediate response
easy to find help
![](https://media0.giphy.com/media/phJ6eMRFYI6CQ/giphy.gif)
Our two attempts at making the world better
ScalaCLI
Metals
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9815892/pasted-from-clipboard.png)
Our two attempts at making the world better
ScalaCLI
Metals
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9815892/pasted-from-clipboard.png)
Better command line interface for Scala
LSP server providing language features to editors such as VS Code, Vim, Emacs, Sublime
scalacli
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9819670/pasted-from-clipboard.png)
Why?
https://scala-cli.virtuslab.org/
get information
It contains information about how to install it, what features are available, cookbooks and guides with multiple example.
Easy to find
installation
Easy to install
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9820287/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9820290/pasted-from-clipboard.png)
Responsive
responsive
- uses fastest compilation tool for Scala - Bloop
- a lot of documentation for the commands
- constructive errors
- actionable diagnostics
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9931289/scalacli.gif)
Every command you would need
good UX
> scala-cli run Main.scala
> scala-cli -S 3.1.3 Main.scala
> scala-cli compile --jvm adopt:14 Main.scala
> scala-cli fmt --check
> scala-cli package --native .
> scala-cli publish .
> scala-cli test .
> scala-cli repl --ammonite .
![](https://media2.giphy.com/media/dgx6W24T3WW1vQS3z4/giphy.gif)
help!
EASY TO FIND HELP
Main commands:
clean Clean the workspace
compile Compile Scala code
dependency-update Update dependencies in project
doc Generate Scaladoc documentation
fmt, format, scalafmt Format Scala code
repl, console Fire-up a Scala REPL
package Compile and package Scala code
publish
publish local
publish setup
run Compile and run Scala code.
test Compile and test Scala code
Miscellaneous commands:
about Print details about this application
version Print `scala-cli` version
See 'scala-cli <command> --help' to read about a specific subcommand.
To see full help run 'scala-cli <command> --help-full'.
Easy to find help
good UX
#!/usr/bin/env -S scala-cli shebang
//> using scala "3.2.0"
object types:
trait Opaque[H, T](using H =:= T):
def apply(s: T): H = s.asInstanceOf[H]
extension (h: H) def value: T = h.asInstanceOf[T]
opaque type Hello = String
object Hello extends Opaque[Hello, String]
@main def hello =
import types.{*, given}
val x = Hello("yes")
x.value
Scripting
- using directives can specify everything CLI can
- can work with shebang
- useful for issues reproductions
default scala runner
-
SIP to use ScalaCLI as a default `scala`
-
Reduced amount of features maybe introduce new via additional SIP
-
current Work on Ux to keep it in line with old runners
-
separate scalacli still useful to experiment with more features
![](https://media3.giphy.com/media/2rqEdFfkMzXmo/giphy.gif)
demo
![](https://media2.giphy.com/media/ygx1aGes6Vg0uv2XvL/giphy.gif)
setup ide
scalacli with ides in mind
all the tools developer needs
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9815892/pasted-from-clipboard.png)
metals
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9815892/pasted-from-clipboard.png)
- user experience depends on LSP
- complicated/ multi faceted
- not much control over the editor
-still we can try some things
metals
![](https://media4.giphy.com/media/eDQjYjLbDGkE/giphy.gif)
-multiple editors supported
- nvim and VS Code easier
- sublime text and emacs ok
metals
Easy to find
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9822797/pasted-from-clipboard.png)
Easy to install
- start the workspace outside container
- gitpod/codespaces
- one click setup
- allows for additional caching
https://github.com/scalameta/metals-gitpod-sample
Easy to install
cloud ides
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9822855/pasted-from-clipboard.png)
1. Added a command to automatically translate stack traces to navigable ones
good UX?
ANALYSE STACKTRACE
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9822691/pasted-from-clipboard.png)
1. Added a command to automatically translate stack traces to navigable ones
2. Add a button for discoverability
good UX?
ANALYSE STACKTRACE
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9822694/pasted-from-clipboard.png)
1. Added a command to automatically translate stack traces to navigable ones
2. Add a button for discoverability
3. [Future] Detect when a stack trace is copied
good UX?
ANALYSE STACKTRACE
![](https://media3.giphy.com/media/YlQQYUIEAZ76o/giphy.gif)
1. Added a command to automatically translate stack traces to navigable ones
2. Add a button for discoverability
3. [Future] Detect when a stack trace is copied
good UX?
ANALYSE STACKTRACE
PRoblems:
-
(1) how to show it in different editors without webview
-
(2) not really a button
-
(2,3) not all editors have it
1. Added a command to automatically translate stack traces to navigable ones
2. Add a button for discoverability
3. [Future] Detect when a stack trace is copied
good UX?
ANALYSE STACKTRACE
PRoblems:
-
(1) how to show it in different editors without webview
-
(2) not really a button
-
(2,3) not all editors have it
solution:
Enrich the LSP protocol
- we have many ways to view the code, why not expose it
- SEMANTICDB, JAVAP, TASTY, CFR DECOMPILER
- easier to debug your code
- helps to see how the tools understand the file
- additional info when sending bug reports
- useful overall
Easy to find help
Metals analyse
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9927977/pasted-from-clipboard.png)
birds eye view of what is happening in the workspace
CONTINUOUSLY IMPROVED
user self help
Metals doctor
![](https://s3.amazonaws.com/media-p.slid.es/uploads/1147195/images/9822754/pasted-from-clipboard.png)
Easy to find help
bugfix loop
Easy to find help
issue reported
issue fixed
issue reproduced
better reporting and
automatic fixes
Demo
![](https://media4.giphy.com/media/MurTjJ7sYflrWru4En/giphy.gif)
still a lot to work on
only few examples
we focus on scala 3, but still works for Scala 2
bright future for scala 3!
Presentation: https://slides.com/tomekgodzik/simple-tooling
Metals documentation: https://scalameta.org/metals/
SCALACLI Documentation: https://scala-cli.virtuslab.org/
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?
Simple Scala 3 Tooling
By Tomek Godzik
Simple Scala 3 Tooling
- 73