Emacs Scala Ensime: Opening REPL does not load any

2019-08-31 03:22发布

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?

1条回答
时光不老,我们不散
2楼-- · 2019-08-31 04:06

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.

查看更多
登录 后发表回答