I am using Emacs 24.5.1
scala 2.11.5
with ensime. Ensime server runs fine with all error suggestion and other IDE feature etc. But when I start debugging code with M-x ensime-db-attach
it prompt with me Hostname
and Port
. Which port is it asking for? I want to debug my code locally.

- 127
- 1
- 13
2 Answers
Executing sbt -jvm-debug 5005
from scala home directory resolved the problem. Also in Emacs M-x ensime-db-attach
when prompted let Hostname
be localhost and Port
be 5005.

- 127
- 1
- 13
I'm assuming that you have used
sbt ensimeConfig
And in Emacs, you've started the Ensime server. What you need to do, is start an sbt session. And in the sbt console, you invoke
ensimeRunDebug fibonacci.Solution
(If you have a package fibonacci and a class called Solution.) This hangs on the console.
You then need to go to your Emacs buffer for your source code with the ENSIME menu and put a breakpoint in. You'll get a message that the message is being queued.
Then attach to the debugger - if you use the ENSIME menu, use the Debugger sub-menu and Attach. You'll need to give the hostname and port. Usually, localhost and port 5005.
This should send the breakpoint and run the program. You'll then be debugging.

- 459
- 4
- 4
-
After you've issued ensimeRunDebug, the OS should have a new Java process listening on the debug port 5005. If, when you attach, the sbt prompt closes, you should get an error message saying that it couldn't find your class. – Bonaparte Mar 14 '19 at 12:40
-
I should say that the debugger isn't very good. I'd like an Immediate buffer. – Bonaparte Mar 14 '19 at 12:42