How to execute dotty code from Visual Studio Code UI

我们两清 提交于 2019-12-24 02:51:21

问题


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?


回答1:


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.

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



来源:https://stackoverflow.com/questions/55079054/how-to-execute-dotty-code-from-visual-studio-code-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!