SublimeText 2 和 SublimeText 2 scala.sublime-build 文件
我正在尝试使用 Sublime Text 2 在 Windows 7 64 位下使用 Scala 2.9.1 编辑和运行 Scala 脚本。我创建了以下 scala.submline-build 文件,尝试跟踪从命令行输入以下内容时发生的情况:
C:\work\Scala>scala ScalaGreetings.scala
Greetings from Scala...
C:\work\Scala>
scala.sublime-build 的内容如下:
{
"cmd": ["C:\\scala-2.9.1.final\\bin\\scala.bat $File"]
}
在 Sublime 中加载简单的 Scala 脚本在“文本”选项卡上,按 F7 键会导致 Scala 解释器被加载并运行,但脚本不会按预期执行。 “构建”窗口中将显示以下内容:
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>
考虑到这一点,我将感谢您对以下问题的帮助和反馈;
1.) 我可以在 Sublime Text 2 中执行 Scala 脚本,并在成功解释脚本后将其输出显示在“构建”窗口中吗?
2.)假设上述问题的答案是肯定的,我的 scala.sublime-text 文件缺少什么和/或不正确?
3.) 在将 Sublime Text 2 与 Scala 一起使用时,我应该查看任何其他资源吗,特别是 Scala 的 Sublime 项目文件?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试使用这个代替:
Try using this instead:
尝试这个构建设置,
我可以用它来解决。
try this build setting
i could solve with it.
请注意,由于变量名称区分大小写,因此
$file
必须为小写。selector
设置帮助 Sublime 自动选择构建系统。有关详细信息,请查看 Sublime Text 的有关构建系统的参考。
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.
我在构建 .scala 文件时遇到了一些问题,我注意到我需要将
shell
参数设置为true
所以这是我的build_systems
>我也总是设置
working_dir
参数,但我想这并不那么重要。所以回答你的问题:
是的,是的,在脚本执行后,你可以在 sublime 中看到输出。
我希望我上面的配置能够帮助您。
我强烈建议您尝试 SublimeREPL 插件。
I had some problems building .scala-files and what i noticed is that I needed to have the
shell
parameter set totrue
so here are mybuild_systems
I always set the
working_dir
parameter as well, but I guess that is not as important.So to answer your questions:
Yes, yeas you can see the output in sublime after the script has been executed.
I hope my config above will help you with that.
I highly recommend that you try the SublimeREPL plugin.
这是针对 Mac OS X 的介绍,但我认为与 Windows,尤其是 Linux 没有太大区别。
在 Scala 中你有两个选择。
第一个选项是使用 Scala 解释器
scala
:在我的例子中,我下载的
scala
文件夹位于/usr/本地/
。第二个选项是编译源代码。这有点困难。
当然,您必须添加
build_scala.sh
bash 脚本文件,例如在/usr/bin/
中:通过输入
which build_scala 在终端中测试脚本。嘘
This is an introduction for Mac OS X, but I do not think, there is a big difference to Windows and especially to Linux.
In Scala you have two options.
First option is using the Scala interpreter
scala
:In my case the
scala
folder, I have downloaded, are placed in/usr/local/
.The second option is to compile your source. This is a little bit more difficult.
Of course you have to add the
build_scala.sh
bash script file, e. g. in/usr/bin/
:Test the script in your terminal by typing
which build_scala.sh
对于 Windows,将 scala 路径添加到环境变量中
使用以下命令设置 Scala.sublime-build 文件:
For windows add scala path to your environment variable
Set the Scala.sublime-build file with following: