[comment]: # Scala on Visual Studio Code

Download and install Scala

Download a scala installation package from here.

Then install it.

  • Linux
scala_package_name=$(ls scala*.tgz | sort -r | head -1)
tar -xzf $scala_package_name
mv ${scala_package_name%.*} scala

Configure system variables:

  • Linux
export SCALA_HOME=/opt/scala
PATH=%PATH%:$SCALA_HOME/bin
  • Windows
SCALA_HOME=C:\Program Files (x86)\scala
PATH=%SCALA_HOME%\bin;%PATH%

Test

scala
  • Output:
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_60).
Type in expressions for evaluation. Or try :help. scala>

Configur a project in visual studio code

  • Open a project via File -> Open Folder...
  • Create a tasks.json file under the .vscode folder in the project folder.
  • Input below in the task.json file
// A task runner that runs a scala program
{
"version": "0.1.0",
"isShellCommand": true,
"args": [],
"showOutput": "always",
"echoCommand": true,
"suppressTaskName": true,
"windows": {
"command": "cmd",
"args": [
"/C",
"scala.bat"
]
},
"linux": {
"command": "sh",
"args": [
"scala"
]
},
"osx": {
"command": "sh",
"args": [
"scala"
]
},
"tasks": [
{
"taskName": "run",
"isBuildCommand": true,
"args": [
"${file}"
]
}
]
}

Note: I am using Windows, you need to change scala.bat to scala (I guess).

Linux

Test it

  • Create a file test.scala with code
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
  • press ctrl+shift+b
  • Output:
Hello, world!

Compile .scala to .jar

scalac -d test.jar D:\project\*

Scala on Visual Studio Code的更多相关文章

  1. 30个极大提高开发效率的Visual Studio Code插件

    译者按: 看完这篇文章,我打算从 Sublime Text 转到 Visual Studio Code 了! 原文: Immensely upgrade your development enviro ...

  2. Visual Studio Code插件

    Material Theme 下载量:130 万 Visual Studio Code 最悠久的主题! Auto Import 下载量:46 万 自动去查找.分析.然后提供代码补全.对于 TypeSc ...

  3. Visual Studio Code(VS code)介绍

    一.日常安利 VS code VS vode特点: 开源,免费: 自定义配置 集成git 智能提示强大 支持各种文件格式(html/jade/css/less/sass/xml) 调试功能强大 各种方 ...

  4. Visual Studio Code 代理设置

    Visual Studio Code (简称 VS Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器,在十多年的编程经历中,我使用过非常多的的代码编辑器(包括 IDE),例如 Fron ...

  5. 在Visual Studio Code中配置GO开发环境

    一.GO语言安装 详情查看:GO语言下载.安装.配置 二.GoLang插件介绍 对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github ...

  6. Visual Studio Code——Angular2 Hello World 之 2.0

    最近看到一篇用Visual Studio Code开发Angular2的文章,也是一篇入门教程,地址为:使用Visual Studio Code開發Angular 2專案.这里按部就班的做了一遍,感觉 ...

  7. docker4dotnet #3 在macOS上使用Visual Studio Code和Docker开发asp.net core和mysql应用

    .net猿遇到了小鲸鱼,觉得越来越兴奋.本来.net猿只是在透过家里那田子窗看外面的世界,但是看着海峡对岸的苹果园越来越茂盛,实在不想再去做一只宅猿了.于是,.net猿决定搭上小鲸鱼的渡轮到苹果园去看 ...

  8. Visual Studio Code v0.9.1 发布

    微软的跨平台编辑器 Visual Studio Code v0.9.1 已经发布,官方博客上发布文章Visual Studio Code – October Update (0.9.1):http:/ ...

  9. 微软Visual Studio Code 0.8.0发布,新增多种主题

    月30日,Build 开发者大会上,正式宣布了 Visual Studio Code 项目;并将其定义为:一个运行于 Mac OS X.Windows和 Linux 之上的,针对于编写现代 Web 和 ...

随机推荐

  1. [原]OpenGL基础教程(四)VBO+纹理绘制四边形

    工程下载地址:http://pan.baidu.com/s/1ntr7NHv 提取码:yf1h 一.本文牵扯知识点梳理: (1)VBO (2)纹理 (3)libpng(加载png) (4)shader ...

  2. ODAC(V9.5.15) 学习笔记(十六)直接访问模式

    直接访问模式(Direct mode)是ODAC最大的特色之一,即不需要安装Oracle客户端,ODAC越过了OCI(Oracle Call Interface ),使用TCP/IP协议就可以直接与O ...

  3. Windows Phone 支持中国移动官方支付

    今天在这里与大家分享一个好消息,Windows Phone 官方支付支持中国移动(MO Payment),在此之前无论是 Windows Phone 的用户还是开发者,都知道在Windows Phon ...

  4. ACE代码编辑器,代码提示,添加自定义数据

    //设置自动提示代码 var setCompleteData = function(data) { var langTools = ace.require("ace/ext/language ...

  5. c与c++中的extern const的区别和联系

    最近复习c++,发现了这个东西. c语言里面,我们在一个.c文件中用const定义了一个全局变量后,可以在另一个.c文件中用extern const来引用,但在c++中在链接的时候会报undefine ...

  6. AjaxUploader使用

    一.简单上传(Simple Upload with Progress) <CuteWebUI:Uploader ID="ajaxUploader" runat="s ...

  7. REHL5.5 linux的postfix的邮件服务器配置 (笔记)

    一.发送邮件服务器(smtp服务器) 1.系统安装时已经有postfix. 2.修改配置 1)vi main.cf //你可以先备份一下配置文件 myhostname = INMSC2//修改为你的主 ...

  8. Asp.net Mvc4 使用Cas单点登录

    因项目需要,使用了耶鲁大学的Cas单点登录方案,在java中使用一直正常,但是在.Net中碰到了循环重定向的问题,反复测试后,总算解决了,最终的配置如下: <?xml version=" ...

  9. CentOS下安装JDK7 转载

    转载地址:http://www.cnblogs.com/rilley/archive/2012/02/02/2335395.html CentOS下安装JDK7 下载地址:http://www.ora ...

  10. Jellycons – iOS 8 图标下载(PNG, SKETCH)

    Jellycons 这套由 LoveUI.co 设计图标包括30款扁平化,圆滑,丰富多彩的 iOS 8 应用程序图标,可以用于于个人和商业项目的使用.另外,PNG 格式包含11种尺寸(1024px, ...