Emacs Scala Ensime:打开REPL不会从我的项目中加载任何东西 [英] Emacs Scala Ensime: Opening REPL does not load anything from my project

查看:321
本文介绍了Emacs Scala Ensime:打开REPL不会从我的项目中加载任何东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很确定我已经设置了Emacs,Ensime,SBT和Scala来正常工作。我可以编辑文件,看到类型错误,当我保存并成功尝试使用ensime的自动重构工具。



问题是当我打开一个REPL按 Cc Cv z 似乎似乎没有加载我的文件。



换句话说,如果我定义的东西像

class Moose {}



当我尝试使用 Moose 从REPL

  scala> ; Moose 
< console>:8:error:not found:value Moose
Moose
^

scala>新的Moose
< console>:8:error:not found:type Moose
new Moose
^

什么是最好的方法来加载某些东西,如当前的缓冲区内容到REPL?

解决方案

我发现REPL实际上没有问题。我一直在尝试通过按 Cc Cb b 来编译我的项目,并假定它正在使用缓冲区 * ENSIME-Compilation-Result * 将弹出以下选项:

 最新编译结果(q退出,TAB跳转到下一个错误)
----------------------------------------

0错误,0警告。

但是,我查看了 target / scala-2.10 / classes 目录,并发现没有生成 .class 文件。



当我从 sbt 的命令行编译时,我能够得到一个加载了我预计。



编辑



我发布了一个后续问题: 使用Ensime构建会删除所有.class文件,但不编译任何内容


I am pretty sure I have setup Emacs, Ensime, SBT, and Scala to work together properly. I am able to edit files and see type errors when I save and have successfully tried using ensime's autorefactoring tools.

The problem is when I open a REPL by pressing C-c C-v z it seems as if nothing from my file is loaded.

In other words if I define something like

class Moose {}

in my source file, this is what happens when I try to use Moose from the REPL

scala> Moose
<console>:8: error: not found: value Moose
              Moose
              ^

scala> new Moose
<console>:8: error: not found: type Moose
              new Moose
                  ^

What is the best way to load something, such as the current buffer contents into the REPL?

解决方案

I found out that there was actually no problem with the REPL. I had been trying to compile my project by pressing C-c C-b b and assumed it was working the buffer *ENSIME-Compilation-Result* would pop up with:

Latest Compilation Results (q to quit, TAB to jump to next error)
----------------------------------------

0 errors, 0 warnings.

But, I checked in the target/scala-2.10/classes directory and found that no .class files were being generated.

When I instead compiled from the command line with sbt, I was able to then get a REPL loaded with what I expected.

EDIT:

I posted a follow-up question: Building with Ensime deletes all .class files, but doesn't compile anything.

这篇关于Emacs Scala Ensime:打开REPL不会从我的项目中加载任何东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆