简体   繁体   English

Emacs Scala Ensime:打开REPL不会从我的项目中加载任何东西

[英]Emacs Scala Ensime: Opening REPL does not load anything from my project

I am pretty sure I have setup Emacs, Ensime, SBT, and Scala to work together properly. 我很确定我已经设置了Emacs,Ensime,SBT和Scala以使其正常工作。 I am able to edit files and see type errors when I save and have successfully tried using ensime's autorefactoring tools. 保存并成功使用ensime的自动重构工具后,我能够编辑文件并看到类型错误。

The problem is when I open a REPL by pressing Cc Cv z it seems as if nothing from my file is loaded. 问题是,当我通过按Cc Cv z打开REPL时,似乎没有加载文件中的任何内容。

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 在我的源文件中,这是当我尝试使用REPL中的Moose时发生的情况

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? 将诸如当前缓冲区内容之类的内容加载到REPL的最佳方法是什么?

I found out that there was actually no problem with the REPL. 我发现REPL实际上没有问题。 I had been trying to compile my project by pressing Cc Cb b and assumed it was working the buffer *ENSIME-Compilation-Result* would pop up with: 我一直在尝试通过按Cc Cb b来编译我的项目,并假定它正在运行缓冲区*ENSIME-Compilation-Result*将弹出:

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. 但是,我检查了target/scala-2.10/classes目录,发现没有生成任何.class文件。

When I instead compiled from the command line with sbt , I was able to then get a REPL loaded with what I expected. 当我改用sbt从命令行进行sbt ,我便可以将期望的内容加载到REPL中。

EDIT : 编辑

I posted a follow-up question: Building with Ensime deletes all .class files, but doesn't compile anything . 我发布了一个后续问题: 使用Ensime构建会删除所有.class文件,但不会编译任何文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM