Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SublimeText 2 & scala.sublime-build File

I'm trying to use Sublime Text 2 to edit and run Scala script under Windows 7 64-Bit using Scala 2.9.1. I've created the following scala.submline-build file, attempting to follow what happens when I enter the following from the command line:

C:\work\Scala>scala ScalaGreetings.scala
Greetings from Scala...
C:\work\Scala>

The contents of the scala.sublime-build are as follows:

{
    "cmd": ["C:\\scala-2.9.1.final\\bin\\scala.bat $File"]
}

With the simple Scala script loaded in a Sublime Text tab, pressing the F7 key results in the Scala interpreter being loaded and running, but the script does not execute as expected. The following appears in the Build window:

Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java    1.7.0_01).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 

With this in mind, I would appreciate your help and feedback with the following questions;

1.) Can I execute a Scala script from within Sublime Text 2 and have its output display inside the Build window after the script is successfully interpreted?

2.) Assuming the answer to the question above is yes, what is missing and/or incorrect with my scala.sublime-text file?

3.) Are there any additional resources I should look at on using Sublime Text 2 with Scala, especially in the way of Sublime Project files for Scala?

like image 580
ClockEndGooner Avatar asked Nov 13 '11 14:11

ClockEndGooner


3 Answers

Try using this instead:

{
    "cmd": ["C:\\scala-2.9.1.final\\bin\\scala.bat", "$File"]
}
like image 156
Aaron Emerson Avatar answered Sep 30 '22 06:09

Aaron Emerson


{
  "cmd": ["C:\\scala-2.9.1.final\\bin\\scala.bat", "$file"],
  "selector": "source.scala"
}

Note that since variable names are case-sensitive, $file must be in lower-case.

The selector setting helps Sublime automatically choose the build system.

For more info check the Sublime Text's reference on build systems.

like image 30
Nikita Volkov Avatar answered Sep 30 '22 07:09

Nikita Volkov


try this build setting

{
    "cmd": ["C:\\scala-2.9.1.final\\bin\\scala.bat","$file"]
}

i could solve with it.

like image 39
airyym Avatar answered Sep 30 '22 05:09

airyym