[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. 【Cocos2d-Js基础教学(7)界面UI更新方法(会用到第三方类库)】

    我们游戏中会遇到很多UI更新的时候,大部分时候我们会remove该节点,再重新绘制的方法来进行UI更新. 但是这种更新效率并不高,这里我推荐大家一个第三方的库,来通过注册更新的方式来对UI进行更新管理 ...

  2. thinking in object pool

    1.背景 对象池为了避免频繁创建耗时或耗资源的大对象,事先在对象池中创建好一定数量的大对象,然后尽量复用对象池中的对象,用户用完大对象之后放回对象池. 2.问题 目前纵观主流语言的实现方式无外乎3个步 ...

  3. PowerShell定时记录操作系统行为

    作为系统管理员,有些时候是需要记录系统中的其他用户的一些操作行为的,例如:当系统管理员怀疑系统存在漏洞,且已经有被植入后门或者创建隐藏账户时,就需要对曾经登陆的用户进行监控,保存其打开或者操作过的文件 ...

  4. Android中AutoCompleteTextView的使用

    1.http://blog.csdn.net/FX_SKY/article/details/9326129 此博客讲解了auto组件如何使用baseAdapter来扩展功能,推荐参照此博客写demo ...

  5. Linux RPM 命令参数使用详解

    rpm 执行安装包二进制包(Binary)以及源代码包(Source)两种.二进制包可以直接安装在计算机中,而源代码包将会由 RPM自动编译.安装.源代码包经常以src.rpm作为后缀名. 常用命令组 ...

  6. Object-C Categories和Protocols

    Category 要扩展一个不可修改的类,通常的做法是为该类创建一个子类,在子类中实现想要实现的方法,在Object-C中,可以通过category来实现,并且实现方式更为简单. 现在有如下定义:一个 ...

  7. mysql DB server端,如何让读写更快

    其实,我不是专业的DB管理同学,甚至算不上会了解.只是在最近的工作中,遇到了DB server端优化的契机,所以把这些手段记录下来: 通过调整这个参数的值,可以让DB更给力: 这两个参数的含义: 1. ...

  8. mssql表名列名对应语句

    if exists (select * from tempdb..sysobjects where name like '#magic%') drop table #magic go select a ...

  9. MFC资源冲突解决方法

    AFX_MANAGE_STATE(AfxGetStaticModuleState())   先看一个例子: 1.创建一个动态链接到MFC DLL的规则DLL,其内部包含一个对话框资源.指定该对话框ID ...

  10. Reactor模式与Proactor模式

    该文章总结了网上资源对这两种模式的描述 原文地址:http://www.cnblogs.com/dawen/archive/2011/05/18/2050358.html 1.标准定义 两种I/O多路 ...