我正在尝试使用Visual Studio Code
运行dotty代码。我根据sbt launchIDE
的指示使用this page启动IDE,我还安装了Dotty Language Server
和Code Runner
扩展。使用brew
安装Dotty,我可以编译并执行CMD的dotty代码。
问题是我无法从Visual Studio Code
运行此代码,因为Code Runner
正在尝试使用scala而不是dotty来执行它。
找不到任何有用的配置来调整此插件以使用dotty。
有没有办法让它可以从Visual Studio Code UI中运行?
克隆存储库https://github.com/lampepfl/dotty-example-project(它在页面https://dotty.epfl.ch/docs/usage/getting-started.html中提到)并运行
sbt launchIDE
(这是在https://dotty.epfl.ch/docs/usage/ide-support.html的精神)。
代码应该使用scala运行(运行时是相同的)。如果使用scalac而不是dotty编译代码,这可能意味着build.sbt
中的scalaVersion错误或plugins.sbt
中未启用dotty 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")
您也可以尝试使用IntelliJ IDEA(虽然它没有得到官方支持)Run Scala Dotty project using Intellij IDE