Xdebug 3’s release has me itching to get a nice step debugging workflow with my PHP projects through kakoune. I know there’s a gdb plugin but I’m not sure that’s the same protocol or could be adapted to something like xdebug.
I made a plugin for dbgp based on the gdb plugin: https://github.com/JJK96/kakoune_dbgp
Nowadays I usually use VSCode for this since I find a TUI a bit lacking for these kind of things, but the plugin should still work fine.
Awesome I’ll give this a try!
@JJK96 I’m having trouble understanding how to connect your plugin to a running xdebug instance. In the README it says “If you wish to start a new debugging session, you should call dbgp-start. A dbgp IDE session will be started which can be used to connect to by a dbgp debugger engine”. However, running that command i have no feedback on how to coordinate it with xdebug. Running the status command from the included user mode gives me no feedback, so I’m pretty much at a loss. In my system monitor I see a running tail and python instance which belong to the included python script, so I feel like I must be missing something small and obvious…
I’m sorry that the plugin doesn’t provide much feedback.
Xdebug is a client-server protocol, this plugin provides the client, while the XDebug extension in your php setup provides the server. When you do dbgp-start, the python script starts the XDebug client which accepts a connection (Yeah, it’s weird that a client accepts a connection, but that’s how it works) on port 9000 (which is configurable). Have a look at https://xdebug.org/docs/step_debug on how to connect the XDebug server with the IDE (client).
I use a browser extension myself, I have configured XDebug to connect to localhost:9000 when a request is made. If the XDebug server successfully connects you should get a message about that in kakoune.
XDebug is a bit of a pain to set up, sadly, nothing I can do about that in this plugin.
I’m not using XDebug 3 yet. From what I read it looks like it will still work fine, but I haven’t tested with XDebug 3. I did test with my current set-up just yet, and everything works fine, so the plugin still works
I just tested with XDebug 3 and it still works fine. I pushed an update to the plugin to change the default port to 9003 since that is the new default debug port of XDebug 3.
I’m going to keep trying until I get this.
Let me know when you get it working (or if you have troubles). To my knowledge you’re the first user of this plugin (besides myself).
Dagnabbit, you beat me to it . I was working on a similar plugin using Microsoft’s Debug Adapter Protocol (DAP), but due to extremely poor time management on my part (and DAP being more complicated than dbgp), it’s not progressing particularly well.
In any case, nice work on this. It’s a shame that so few dbgp debugging engines exist - it’s a fairly simple and elegant protocol for what it does (apart from the pain of getting XDebug set up).
My plugin still has quite a few rough edges, so if you feel like improving it, please do!