如何从Visual Studio Code UI执行点代码 [英] How to execute dotty code from Visual Studio Code UI

查看:138
本文介绍了如何从Visual Studio Code UI执行点代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Visual Studio Code运行点代码.我根据此页面中的说明使用sbt launchIDE启动了IDE. ,并且我还安装了Dotty Language ServerCode 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

这篇关于如何从Visual Studio Code UI执行点代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆