I'm pretty new to ENSIME. I'm trying to do incremantal compilation within Emacs by compiling single file one-by-one with SBT . Let's say I have a file a.scala that imports a class in file b.scala. If I try to compile only a.scala using C-c C-b C it obviously complains as b.scala has not been compiled. If I try to compile b.scala still using C-c C-b C it correctly compiles, but after that I still cannot compile a.scala.
I tried using the same procedure of compiling b.scala and a.scala using IntelliJ and it works fine. What am I missing?
Glancing at the code for ensime-sbt, it doesn't look like the target class-path is included in the input class-path. As such, while
ensimeCompileOnlysees the JAR dependencies, it would not see any peer compiled classes (I am observing this with sbt 1.x.x). Ideally, it would and I don't think there is a strong reason to do otherwise.Have a look at CompatExtras.scala where the compileOnlyTask is defined. Also, perhaps open up a ticket on ensime-sbt, and try to open a discussion. If what is implemented is ideal, then the documentation could be updated to reflect that.
Just to note, Ensime does not have a dedicated maintainer today. A few of us lurk to help contributions get merged in occasionally. The highest chance of this being fixed is by being proactive. I'd start by updating the tests found in
./src/sbt-test-0.13/sbt-ensime/compile-only/testto have project dependencies (you'll notice that there are none between Foo, Baz, and FooTest). Perhaps you could have FooTest reference Foo, and watch the test fail, and proceed accordingly.