5

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

问题是我无法从中运行此代码,Visual Studio Code因为我Code Runner试图使用 scala 而不是 dotty 来执行它。

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

有什么方法可以让它在 Visual Studio Code UI 中运行?

4

1 回答 1

3

克隆存储库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编译的,这可能意味着 scalaVersion 错误build.sbt或 dotty sbt 插件未在plugins.sbt.

在此处输入图像描述

构建.sbt

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

插件.sbt

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

您也可以尝试 IntelliJ IDEA(虽然它不受官方支持)使用 Intellij IDE 运行 Scala Dotty 项目

于 2019-03-09T16:10:04.450 回答