Unable to start Ensime debugger in Emacs

302 Views Asked by At

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.

2

There are 2 best solutions below

0
Prabhat On BEST ANSWER

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.

2
Bonaparte On

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.