Metals LSP Server

growing the community!

Tomasz Godzik

Questions!

Please ask in the chat!

Will try to answer all at the end.

 

Or at the Q&A session next

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?

Who Contributed to what metals is today?

Who Contributed to what metals is today?

Metals - Scala language server with rich ide features

The language server protocol

Your favourite language in you favourite Editor

How does it work

Client Editor

LSP Server

How does it work

Client Editor

LSP Server

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

Completions

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

Completions

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

- adding()

- additional

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

- adding()

- additional

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  addi_
}

How does it work

Client Editor

LSP Server

object Main{
  def adding(a : Int, b : Int) = a + b
  val additional = ""
  val one = 1
  val two = 2
  adding(_)
}

Many other features!

  • Diagnostics
  • Goto definition
  • Completions
  • Hover
  • Parameter hints
  • Find references
  • Find implementations
  • Rename symbol
  • Code actions
  • Document symbols
  • Workspace symbols
  • Formatting
  • Folding
  • Highlight

Many other features!

  • Diagnostics
  • Goto definition
  • Completions
  • Hover
  • Parameter hints
  • Find references
  • Find implementations
  • Rename symbol
  • Code actions
  • Document symbols
  • Workspace symbols
  • Formatting
  • Folding
  • Highlight
  • Execute command

Extensions!

  • Worksheets
  • Tree view
  • Quick pick
  • Slow task

The build server protocol

The universe of Build tools

Mill

Seed

The universe of Build tools

Mill

Seed

Metals

Mill

Seed

The universe of Build tools

Bloop

LSP Server

BLOOP AND BSP

Bloop

LSP Server

What is this code a part of!

 

BLOOP AND BSP

Bloop

LSP Server

Which project?

BLOOP AND BSP

Bloop

LSP Server

BLOOP AND BSP

Which project?

Bloop

LSP Server

BLOOP AND BSP

Bloop

LSP Server

Project Foo

BLOOP AND BSP

Bloop

LSP Server

Project Foo

BLOOP AND BSP

Bloop

LSP Server

I don't know how to compile it!

BLOOP AND BSP

Bloop

LSP Server

Compile Foo!

BLOOP AND BSP

Bloop

LSP Server

Compile Foo!

BLOOP AND BSP

Bloop

LSP Server

BLOOP AND BSP

Bloop

LSP Server

Error report

BLOOP AND BSP

Bloop

LSP Server

Error report

BLOOP AND BSP

Bloop

LSP Server

Diagnostics

BLOOP AND BSP

Scala

The pain points

AKA 

What we are doing to grow the community?

Hard to hire new developers

How long have you been using Scala?

Hard to hire new developers

Where did you learn scala?

Hard to hire new developers

How are you using Scala?

JDK setup

- done automatically for you by Metals.

- Just install  Visual Studio Code plugin and you're good to go

- lenses appear over any code to run

- just click and run

 

EASY WAY TO RUN AND DEBUG

- evaluate any code on the go!

- no need for a build tool

- can share classpath with project

 

Worksheets

- reuse the g8 templates

- list of default curated templates

- Download others from github

- PR Soon

 

New project setup

- Gitpod allows to open any project in an online workspace

 

Gitpod and Eclipse Theia

- Gitpod allows to open any project in an online workspace

 

- uses eclipse theia ide

Gitpod and Eclipse Theia

Gitpod and Eclipse Theia

- Gitpod allows to open any project in an online workspace

 

- uses eclipse theia ide

 

- go to  GITHUB.COM/TGODZIK/METALS-SAMPLE

Gitpod and Eclipse Theia

- Gitpod allows to open any project in an online workspace

 

 - uses eclipse theia ide 

 

- go to  GITHUB.COM/TGODZIK/METALS-SAMPLE

 

- GREAT OPPORTUNITY FOR LEARNING SETUP

 

 

Gitpod and Eclipse Theia

- Gitpod allows to open any project in an online workspace

 

 - uses eclipse theia ide 

 

- go to  GITHUB.COM/TGODZIK/METALS-SAMPLE

 

- GREAT OPPORTUNITY FOR LEARNING SETUP

 

- NO NEED TO WRANGLE WITH ANY ISSUE SPECIFIC TO USER'S COMPUTER

Gitpod and Eclipse Theia

- Gitpod allows to open any project in an online workspace

 

 - uses eclipse theia ide 

 

- go to  GITHUB.COM/TGODZIK/METALS-SAMPLE

 

- GREAT OPPORTUNITY FOR LEARNING SETUP

 

- NO NEED TO WRANGLE WITH ANY ISSUE SPECIFIC TO USER'S COMPUTER

 

- ALL IMPROVEMENTS AVAILABLE AS SOON AS THEY ARE MERGED

ONLINE IDES

DEMO!

 

Tooling

Scala main pain points in daily work?

Tooling - others

Pain points in dev setup

tooling

Long Compile times

Bloop is fast and optimized for development experience

It will be possible to offload compilation to Bloop from build tools

Only compile once

works with hydra

MEtals as an Alternative to Intellij

- Intellij is still the most wholesome solution

- multiple features

- a lot of additional tools

- probably best for Scala

 

MEtals as an Alternative to Intellij

- not everyone needs every possible feature

- indexing times are a killer

- it's large and unwieldy for quick editing

- additional barrier if you start with Scala

- Intellij is still the most wholesome solution

- multiple features

- a lot of additional tools

- probably best for Scala

 

but

Sbt / Build tool setup

- many supported build (tools 6 + 2 in progress)

 

 

- there is an initiative to create zero dependencies workspaces

 

 

- possible simple build tool that could work for beginners and generate sbt

Mill

Seed

- reuse the same mechanism as Gitpod

 

OPTIMIZED WORKSPACES

OPTIMIZED WORKSPACES

- REUSE THE SAME MECHANISM AS GITPOD

 

- CREATE DOCKER IMAGES WITH READY COMPILED CODE AND INDEXES PREPARED

 

OPTIMIZED WORKSPACES

- REUSE THE SAME MECHANISM AS GITPOD

 

- CREATE DOCKER IMAGES WITH READY COMPILED CODE AND INDEXES PREPARED

 

- CONNECT VIA VISUAL STUDIO CODE SSH

 

 

OPTIMIZED WORKSPACES

- REUSE THE SAME MECHANISM AS GITPOD

 

- CREATE DOCKER IMAGES WITH READY COMPILED CODE AND INDEXES PREPARED

 

- CONNECT VIA VISUAL STUDIO CODE SSH

 

- DOCKER CONTAINERS CAN BE ACCESSIBLE VIA WEB

 

 

OPTIMIZED WORKSPACES

- REUSE THE SAME MECHANISM AS GITPOD

 

- CREATE DOCKER IMAGES WITH READY COMPILED CODE AND INDEXES PREPARED

 

- CONNECT VIA VISUAL STUDIO CODE SSH

 

- DOCKER CONTAINERS CAN BE ACCESSIBLE VIA WEB

 

- KUBERNETES? ECLIPSE CHE?

 

OPTIMIZED WORKSPACES

DEMO

 

OPTIMIZED WORKSPACES

Again?!!!

DEMO

 

SCALA 3 MIGRATION

What are your fears with regards to Scala 3?

THE FUTURE OR SCALA 3

- PR with support ready

 

 

 

 

THE FUTURE OR SCALA 3

- PR with support ready

 

- More features coming soon

 

 

 

THE FUTURE OR SCALA 3

- PR with support ready

 

- More features coming soon

 

- Will make sure there is feature parity with current Metals Scala 2 support

 

 

THE FUTURE OR SCALA 3

- PR with support ready

 

- More features coming soon

 

- Will make sure there is feature parity with current Metals Scala 2 support

 

- making sure everything works well for the developer

 

- PR with support ready

 

- More features coming soon

 

- Will make sure there is feature parity with current Metals Scala 2 support

 

- making sure everything works well for the developer

 

- more features will done for Scala 3 itself (Optional braces)

THE FUTURE OR SCALA 3

Some fun new concepts

THE FUTURE OR SCALA 3

Some fun new concepts

THE FUTURE OR SCALA 3

trait A:
  def f: Int

class C(x: Int) extends A:
  def f = x

object O:
  def f = 3

Optional braces

Some fun new concepts

THE FUTURE OR SCALA 3

trait A:
  def f: Int

class C(x: Int) extends A:
  def f = x

object O:
  def f = 3

Optional braces

val x: String = ???
val y: String | Null = ???

x == null       // error
x eq null       // error
"hello" == null // error

y == null       // ok
y == x          // ok

explicit nulls

Some fun new concepts

THE FUTURE OR SCALA 3

trait A:
  def f: Int

class C(x: Int) extends A:
  def f = x

object O:
  def f = 3

Optional braces

val x: String = ???
val y: String | Null = ???

x == null       // error
x eq null       // error
"hello" == null // error

y == null       // ok
y == x          // ok

explicit nulls

@main def helloWorld(
  age: Int, 
  name: String, 
  others: String*
) = {
  println(s"Hello $name!")
  println(s"You are $age years old")
}

outer methods

Some fun new concepts

THE FUTURE OR SCALA 3

trait A:
  def f: Int

class C(x: Int) extends A:
  def f = x

object O:
  def f = 3

Optional braces

val x: String = ???
val y: String | Null = ???

x == null       // error
x eq null       // error
"hello" == null // error

y == null       // ok
y == x          // ok

explicit nulls

@main def helloWorld(
  age: Int, 
  name: String, 
  others: String*
) = {
  println(s"Hello $name!")
  println(s"You are $age years old")
}

outer methods

case class Circle(
  x: Double, 
  y: Double, 
  radius: Double
)

def (c: Circle).circumference: Double = 
  c.radius * math.Pi * 2

Extension methods

Some fun new concepts

 

Besides:

- simplified pattern matching

- better macros

- enums

- focus on ease of migration

- implicit suggestions

- a lot of even more modern features

 

THE FUTURE OR SCALA 3

trait A:
  def f: Int

class C(x: Int) extends A:
  def f = x

object O:
  def f = 3

Optional braces

val x: String = ???
val y: String | Null = ???

x == null       // error
x eq null       // error
"hello" == null // error

y == null       // ok
y == x          // ok

explicit nulls

@main def helloWorld(
  age: Int, 
  name: String, 
  others: String*
) = {
  println(s"Hello $name!")
  println(s"You are $age years old")
}

outer methods

case class Circle(
  x: Double, 
  y: Double, 
  radius: Double
)

def (c: Circle).circumference: Double = 
  c.radius * math.Pi * 2

Extension methods

Recent Work

- run and debug for tests and main methods


- go to implementations


- rename symbol


- code actions


- worksheet support

 

NEWEST Metals FEATURES

Coming soon

 

- go to parent code lenses

 

 

 

Coming soon

 

- go to parent code lenses

 

- BETTER SUPPORT FOR LAUNCHING MAIN METHODS AND TESTS

 

 

Coming soon

 

- go to parent code lenses

 

- BETTER SUPPORT FOR LAUNCHING MAIN METHODS AND TESTS

 

- Ammonite script support

 

 

Coming soon

 

- go to parent code lenses

 

- BETTER SUPPORT FOR LAUNCHING MAIN METHODS AND TESTS

 

- Ammonite script support

 

- SUPPORT FOR SCALA 3!!!

 

Future work

Last year Scala Days talk by Ólafur Páll Geirsson

https://tinyurl.com/metals-scala

 

Presentation: https://slides.com/tomekgodzik/growing


Metals documentation: https://scalameta.org/metals/

 

Bloop documentation: https://scalacenter.github.io/bloop/

 

Shout at me on Twitter: @TomekGodzik  

 

OR

 

Ask me about anything on Slack!

QUESTIONS?

Metals - growing the community

By Tomek Godzik

Metals - growing the community

  • 255