A Metals Retrospective

Chris Kipp

A little about me

  • Software engineer at Lunatech
  • Big Neovim fan
  • Enjoy working on tooling
  • One of the current Metals maintainers and author of the Metals Nvim/Vim extensions

@ckipp01

What's the plan?

  • Short intro
  • An overview of Metals in 2020
  • A look at the 2020 year-end survey results
  • Frustrations with Metals
  • Most commonly asked for
  • Some extra stuff
  • Demo? Questions?

What is Metals?

  • Scala language server with rich IDE features

  • ... provides language features like auto complete, go to definition, find all references etc.
  • Work with any editor that knows LSP... more or less
  • Scalameta + Language Server --> Metals

https://microsoft.github.io/language-server-protocol/

A Retrospective?

The team

Tomasz

Godzik

Ólafur Geirsson

Gabriele Petronella

Plus many more

https://github.com/scalameta/metals/graphs/contributors

A look at 2020

 

Some quick stats

 

 

  • 171k downloads of Metals
  • VS Code extension just over 100k downloads
  • coc-metals extension had just over 20k downloads
  • just under 700 merged prs to Metals
  • saw 13 releases
  • 46 contributors
  • 54k unique visitors to the Metals website

LSP Methods

 

  • textDocument/implementations
  • textDocument/rename
  • textDocument/codeAction
    • Import missing symbol
    • Insert missing abstract members
    • Create new symbol
    • Import all missing symbols
    • Organize imports
    • Insert inferred type refactoring
    • Organize imports

Debugging

 

Support in...

  • VS Code
  • Nvim
  • Emacs

Worksheets

 

Analyze Stacktrace

 

Synthetics

  • Show implicits and type decorations

  • Show implicit conversions and classes.

  • Type decorations for definitions.

Other features

 

  • New file provider
  • Rename preview
  • Super method code lenses
  • Ammonite Support
  • New project provider using g8
  • Multiple build tool selection within a workspace
  • sbt file support
  • Customizable package exclusions
  • sbt BSP support
  • Remote debugging
     

Survey Results

 

Editors

 

Why so much focus on VS Code?

 

Agnostic editor support

 

https://github.com/scalameta/nvim-metals

https://github.com/mfussenegger/nvim-dap

Agnostic editor support

 

https://github.com/scalameta/coc-metals

Agnostic editor support

 

Metals Extensions

 

  • https://github.com/scalameta/metals-vscode
  • https://github.com/scalameta/coc-metals
  • https://github.com/scalameta/nvim-metals
  • https://github.com/scalameta/metals-sublime
  • https://github.com/scalameta/metals-eclipse
  • https://github.com/emacs-lsp/lsp-metals

This is a fantastic way to contribute to Metals

Will you support IntelliJ?

 

Why do you use Metals?

 

I wanted fully open source solution

I wanted a lighter weight alternative to other IDEs

I wanted more accurate compiler errors

I wanted to use my favorite editor

Metals has features other IDE's don't

Build Tools

 

Build Tools Desired Support

 

BUILD TOOL VOTES
Bazel 17
Fury 12
Pants 3
Seed 1
Ammonite 1
Generic workspace containing .bloop/ 1
Make 1

Build Tools Desired Support

 

BUILD TOOL VOTES
Bazel 17

Build Tools Desired Support

 

BUILD TOOL VOTES
Bazel 17

Your editor

Build definition

LSP

BSP

Language

Server

Build

Server

Build Tools Desired Support

 

BUILD TOOL VOTES
Fury 12
Seed 1
Generic workspace containing .bloop/ 1

Metals Frustrations

<insert here> doesn't work for YourFault.scala. There can be many reasons for this error.

  • When something goes wrong... I want to know what went wrong
  • When my build import doesn't work, I want to know why it didn't work
  • If my worksheet isn't evaluating... why not?

Wait a second, we know some of this

Stablity

  • Memory usage (thankfully mostly addressed already)
    • Bloop
    • Metals
  • Stable (and clear?) BSP connections
    • Smooth re-connections
    • Smooth reloads
  • Better recoverable state
    • Basically we hope you never have to `rm -rf .bloop .metals`

This would be a KILLER feature

I want that Scala 3 goodness

I want

  • Better completions
  • Auto imports
  • Better signatures
  • To see inferred types

You keep mentioning Scalameta (trees)

What about... Java

You keep mentioning Scalameta (semanticDB)

❯ metap Main.scala.semanticdb
src/main/scala/example/Main.scala
---------------------------------

Summary:
Schema => SemanticDB v4
Uri => src/main/scala/example/Main.scala
Text => empty
Language => Scala
Symbols => 3 entries
Occurrences => 10 entries

Symbols:
example/Main. => final object Main extends AnyRef with App { +2 decls }
example/Main.x. => val method x: Int
example/Main.z. => val method z: Int

Occurrences:
[0:8..0:15) <= example/
[2:7..2:11) <= example/Main.
[2:20..2:23) => scala/App#
[2:24..2:24) => java/lang/Object#`<init>`().
[3:6..3:7) <= example/Main.x.
[5:6..5:7) <= example/Main.z.
[5:10..5:11) => example/Main.x.
[5:12..5:13) => scala/Int#`*`(+3).
[7:2..7:9) => scala/Predef.println(+1).
[7:10..7:11) => example/Main.z.

Refactorings

  • New code actions?
  • Better support to move files around
  • Extract stuff maybe?
  • A whole bunch of other options...

but time...

Multi-workspace support

workspace/workspaceFolders

.
├── myAwesomeProject
│  ├── build.sbt
│  └── src
├── myOtherProject
│  ├── build.sbt
│  └── src
└── yetAnotherProject
   ├── build.sbt
   └── src

Better support for non-compiling workspaces

Some extra thoughts and reactions

We plan to release v1 this year

A note about extensions

  • Having a specific extension can totally change the Metals experience
  • We make somewhat heavy usage of LSP extensions
  • Automate stuff that can be automated
  • Things can be done in line with the editor

Metals isn't going anywhere

Plus the community

Documentation helps

Questions???