如何从 Visual Studio 代码 UI 执行点代码

How to execute dotty code from Visual Studio Code UI

我正在尝试使用 Visual Studio Code 到 运行 点代码。根据 this page 的说明,我开始使用 sbt launchIDE IDE,并且还安装了 Dotty Language ServerCode Runner 扩展。 Dotty 是使用 brew 安装的,我可以从 CMD 编译和执行 dotty 代码。

问题是我无法 运行 来自 Visual Studio Code 的这段代码,因为 Code Runner 正在尝试使用 scala 而不是 dotty 来执行它。

找不到任何有用的配置来调整此插件以使用 dotty。

有什么方法可以使它从 Visual Studio 代码 UI 开始工作吗?

克隆存储库 https://github.com/lampepfl/dotty-example-project (it's mentioned at the page https://dotty.epfl.ch/docs/usage/getting-started.html) 和 运行

sbt launchIDE

(这在 https://dotty.epfl.ch/docs/usage/ide-support.html 中提到)。

代码应该是运行 with scala(运行时间是一样的)。如果代码是 compiled with 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(虽然官方不支持)