如何从Visual Studio Code UI执行点代码
我正在尝试使用Visual Studio Code
运行点代码.我根据此页面中的说明使用sbt launchIDE
启动了IDE. ,并且我还安装了Dotty Language Server
和Code Runner
扩展名. Dotty是使用brew
安装的,我可以从CMD编译和执行Dotty代码.
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.
问题是我无法从Visual Studio Code
运行此代码,因为Code Runner
试图使用scala而不是dotty来执行它.
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.
找不到任何有用的配置来调整此插件以使用dotty.
Can't find any useful configuration to adjust this plugin to use dotty.
有什么方法可以使它在Visual Studio Code UI中起作用?
Is there any way to make it works from Visual Studio Code UI?
克隆存储库 https://github.com/lampepfl/dotty-example-project (在
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
(在 https://dotty.epfl.ch/docs/usage/ide-support.html ).
该代码应使用Scala 运行(运行时间相同).如果代码是使用scalac而不是dotty 编译的,这可能意味着scalaVersion在build.sbt
中是错误的,或者dotty sbt插件在plugins.sbt
中未打开.
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")
此外,您也可以尝试IntelliJ IDEA(尽管不受官方支持)运行Scala使用Intellij IDE的Dotty项目
Also you can try IntelliJ IDEA (although it's not officially supported) Run Scala Dotty project using Intellij IDE