带有 VScode 的 Scala

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29963516/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 07:06:18  来源:igfitidea点击:

Scala with VScode

scalasyntax-highlightingvisual-studio-code

提问by Steve

I started to use vscode for python development. And I really like it, does anyone know how to extend VScode so I can write scala in it as well ?

我开始使用 vscode 进行 python 开发。而且我真的很喜欢它,有人知道如何扩展 VScode 以便我也可以在其中编写 Scala 吗?

At the bare minimum I need to get syntax highlighting working.

至少我需要让语法突出显示工作。

回答by Omid

There is one here:

这里有一个:

https://github.com/IliyaTryapitsin/vscode-scala

https://github.com/IliyaTryapitsin/vscode-scala

You can add it by reading the readme there which is:

您可以通过阅读那里的自述文件来添加它:

Run VSCode

运行 VSCode

code --enableExtensionGallery

Press F1 then input:

按F1然后输入:

for scala installation

用于 Scala 安装

ext install scala

for sbt installation

用于 sbt 安装

ext install sbt

for snippets installation

用于片段安装

ext install scalasnippets

回答by Jethro

Scala works well in VS Code 2019.

Scala 在 VS Code 2019 中运行良好。

There's official syntax highlighting, and a Language Server called Metals(which replaces Ensime which is mentioned in other answers).

有官方的语法突出显示,以及一个名为Metals的语言服务器(它取代了其他答案中提到的 Ensime)。

回答by user6273920

If your NOT using Intellij or Eclipse and want to stick to VSCode, then I highly recommend Ensime & Ensime plugin below: https://marketplace.visualstudio.com/items?itemName=dragos.scala-lspAlso check out, www.ensime.org It's a bit more involved to setup ensime env but still worth it.

如果您不使用 Intellij 或 Eclipse 并想坚持使用 VSCode,那么我强烈推荐下面的 Ensime 和 Ensime 插件:https://marketplace.visualstudio.com/items?itemName =dragos.scala-lsp 另请查看,www.ensime .org 设置ensime env 涉及更多,但仍然值得。

Discussion of two is below here: https://www.reddit.com/r/scala/comments/5eu9if/intellij_vs_ensime/

两个的讨论如下:https: //www.reddit.com/r/scala/comments/5eu9if/intellij_vs_ensime/

However, Intellij has improved a lot. So, the beauty contest is a matter of judgement call. I have been switch back & forth between many variations (Emacs, Intellij, neovim, VSCode). It's a complicated language. So, I need all the help I can get!

但是,Intellij 改进了很多。所以,选美比赛是一个判断力的问题。我一直在许多变体(Emacs、Intellij、neovim、VSCode)之间来回切换。这是一种复杂的语言。所以,我需要我能得到的所有帮助!

回答by Chromableed Studios

If you dig into the applications path it looks to me to be extensible in .js, take a look at the javascript and typescript folders for example(though I haven't tried it yet)

如果您深入研究应用程序路径,我认为它可以在 .js 中扩展,例如查看 javascript 和 typescript 文件夹(尽管我还没有尝试过)

回答by Sofian Hnaide

Visual Studio Code does not have a language extensible story yet, but it could be coming soon. https://code.visualstudio.com/Docs/languages#_common-questions

Visual Studio Code 还没有语言可扩展的故事,但它可能很快就会出现。 https://code.visualstudio.com/Docs/languages#_common-questions

回答by oetzi