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

五迷三道 提交于 2019-12-25 03:08:15

问题


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:


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.



来源:https://stackoverflow.com/questions/21563101/emacs-scala-ensime-opening-repl-does-not-load-anything-from-my-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!