5

I'm trying to use Visual Studio Code to run dotty code. I started IDE using sbt launchIDE according to the instruction from this page, and I also installed Dotty Language Server and Code Runner extensions. Dotty is installed using brew and I can compile and execute dotty code from CMD.

The problem is that I cannot run this code from Visual Studio Code because Code Runner is trying to execute it using scala instead of dotty.

Can't find any useful configuration to adjust this plugin to use dotty.

Is there any way to make it works from Visual Studio Code UI?

stefanobaghino
  • 11,253
  • 4
  • 35
  • 63
Bogdan Vakulenko
  • 3,380
  • 1
  • 10
  • 25

1 Answers1

3

Clone repository https://github.com/lampepfl/dotty-example-project (it's mentioned at the page https://dotty.epfl.ch/docs/usage/getting-started.html) and run

sbt launchIDE

(this is mentined at https://dotty.epfl.ch/docs/usage/ide-support.html).

The code should be run with scala (runtime is the same). If the code is compiled with scalac instead of dotty this can mean that either scalaVersion is wrong in build.sbt or dotty sbt plugin is not switched on in plugins.sbt.

enter image description here

build.sbt

lazy val root = project
  .in(file("."))
  .settings(
    name := "dottydemo",
    version := "0.1",
    scalaVersion := "0.13.0-RC1"
)

plugins.sbt

addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.3.0")

Also you can try IntelliJ IDEA (although it's not officially supported) Run Scala Dotty project using Intellij IDE

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
  • Yes. All my config files contain correct configurations and versions and I'm using `sbt launchIDE`, but when I do "Run Code" from UI it compiles code using scala instead of dotty. Can't compile code from your screenshot too. `sbt compile` and `sbt run` commands work well for me. Maybe I need some extra sbt extension on Visual Studio Code. – Bogdan Vakulenko Mar 09 '19 at 17:33
  • @BogdanVakulenko Did you manage to resolve your issue? If so, how? – Timo Meijer Nov 27 '19 at 12:58
  • @TimoMeijer Unfortunately, not. I just started compiling and running using command line tools. – Bogdan Vakulenko Nov 27 '19 at 13:11
  • @BogdanVakulenko I'm now doing it with a Task(ctrl-shift-p -> task). I made tasks for both `sbt run` and `sbt ~run`, which works great for me to run/test the code – Timo Meijer Nov 28 '19 at 18:40