Add these lines to
~/.sbt/0.13/plugins/plugins.sbt as opposed to
project/plugins.sbt (the decision to use ENSIME is per-user, rather than per-project):
addSbtPlugin("org.ensime" % "ensime-sbt" % "0.2.0")
Check that again, if you incorrectly used
~/.sbt/0.13/plugins.sbt you'll get an sbt resolution error, it really has to be in the
gen-ensime--- Generate a
.ensimefor the project.
gen-ensime-meta--- Generate a
project/.ensimefor the meta-project.
debugging--- Add debugging flags to all forked JVM processes.
debugging-off--- Remove debugging flags from all forked JVM processes.
Note that downloading and resolving the sources and javadocs can take some time on first use.
(Copied from EnsimePlugin.scala)
If you do not
fork your main methods and tests from
sbt you may be able to attach a remote debugger to the entire session by starting like
sbt -jvm-debug 1337 (check the docs of your
sbt script, we strongly recommend using paulp's sbt-extras). However, the vast majority of projects enabled forking and that is when
debugging is useful.
This sample session shows how easy it is to remotely debug a forked test:
crossbuild ~/Projects/ensime-server sbt > debugging [warn] Enabling debugging for all forked processes [info] Only one JVM can use the port and it will await a connection before proceeding. > jerk/test-only *JerkFormatsSpec Listening for transport dt_socket at address: 5005
at which point, the test will hang until you connect a remote debugger to port 5005. When you are finished debugging, cancel the test or let it run to completion, and then type
Note: If you'd like to debug using ensime-emacs, first set your breakpoints, then use ensime-db-attach to connect.
Also note: By
C-c will not cancel a running subprocess. As this is counter-intuitive, this plugin enables
C-c by setting
cancelable in Global := true so that you don't have to. Emacs users should recall that in order to send a control sequence to the
sbt-mode subprocess, prefix the command with
Customising EnsimeKeys is done via the usual sbt mechanism, e.g. insert the following into
import org.ensime.Imports.EnsimeKeys EnsimeKeys.debuggingPort := 1337