Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute dotty code from Visual Studio Code UI

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?

like image 359
Bogdan Vakulenko Avatar asked Oct 16 '22 05:10

Bogdan Vakulenko


1 Answers

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

like image 160
Dmytro Mitin Avatar answered Oct 21 '22 01:10

Dmytro Mitin