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

问题描述 投票:0回答:1

我正在尝试使用Visual Studio Code运行dotty代码。我根据sbt launchIDE的指示使用this page启动IDE,我还安装了Dotty Language ServerCode Runner扩展。使用brew安装Dotty,我可以编译并执行CMD的dotty代码。

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

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

有没有办法让它可以从Visual Studio Code UI中运行?

scala visual-studio-code dotty
1个回答
1
投票

克隆存储库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插件。

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")

您也可以尝试使用IntelliJ IDEA(虽然它没有得到官方支持)Run Scala Dotty project using Intellij IDE

© www.soinside.com 2019 - 2024. All rights reserved.