How Metals and LSP allow you to use your  favorite editor for Scala

Chris Kipp

A huge thank you

A huge thank you

Tomasz

Godzik

Ólafur Geirsson

Gabriele Petronella

What is LSP?

 

What is Metals?

 


 

What is LSP?

 

2 Approaches

 

IDE

Features

Editor

Client

Server

Editor

Features

the problem

 

the problem

 

Features

Editor

Server

Client

???

???

LSP

 

 

The idea behind the Language Server Protocol (LSP) is to standardize the protocol for how tools and servers communicate, so a single Language Server can be re-used in multiple development tools, and tools can support languages with minimal effort.

 

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

LSP

 

  • Created in 2016
  • Headed up by Microsoft while developing VS Code and TypeScript
  • Now also sponsored by Codenvy, Red Hat and Sourcegraph

LSP

 

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

LSP

 

[Trace - 11:53:10 AM] Sending notification 'window/showMessage'
Params: {
  "type": 4,
  "message": "Compiling root 2s"
}


[Trace - 11:53:10 AM] Sending notification 'textDocument/publishDiagnostics'
Params: {
  "uri": "file:///.../test-project/src/main/scala/example/Other.scala",
  "diagnostics": []
}


[Trace - 11:53:10 AM] Sending notification 'window/logMessage'
Params: {
  "type": 4,
  "message": "INFO  time: compiled root in 2.67s"
}

LSP

 

LSP

 

LSP extensibility

 

Sometimes the spec doesn't cover all use cases for a language.

  • Decoration Protocol
  • Tree View Protocol

Questions about LSP?

 

What is Metals?

 

What is Metals?

 

Demo

 

Bloop

 

  • Primarily authored by Jorge Cantero at the Scala Center
  • Scala Build Server
  • Wrapper around Zinc, a Scala incremental Compiler

LSP

BSP

https://vimeo.com/369272491

Scalameta

 

Developer tooling for Scala

ASTs

 

SemanticDB

 

SemanticDB is a data model for semantic information such as symbols and types about programs in Scala and other languages."

https://scalameta.org/docs/semanticdb/guide.html

Demo

 

LSP Extensions

 

  • Decoration Protocol
  • Tree View Protocol

Metals Extensions

 

Questons?

 

Resources

Â