Closed frere-jacques closed 5 months ago
Okay, after I read through the source code, I eventually found the response and request function in the session module.
And the description about the session object. With a bit of try and error I found that I can do something like this:
dap.listeners.before["event_probe-rs-rtt-channel-config"]["plugins.nvim-dap-probe-rs"] = function(session, body)
session:request("rttWindowOpened", { body.channelNumber, true })
end
With this I managed to get the debugger to send the data printed to the RTT channel. If I find out how to print to the log or repl in nvim-dap-ui, I think I have all parts at hand to complete this.
For anybody searching how you can print to the dap-repl of nvim-dap instead of nvim repl.
local repl = require "dap.repl"
repl.append(vim.inspect(body.data))
I would prefer to print to the dapui_console instead, but, I couldn't find anything.
Problem Statement
I want to set up probe-rs for nvim dap. Probe-rs uses dap events to configure and provide RTT prints over dap in a debug session. See the discussion 1259.
The debugger sends an event "probe-rs-rtt-channel-config". If this event is not responded with a dap response, the following prints in the code will not be sent as dap events.
So setting up a listener on "probe-rs-rtt-channel-config" that extracts the content is not sufficient.
Possible Solutions
If there is a function to create dap repsonses inside the listener function. One could establish this communication channel within nvim-dap.
Maybe it's already there, but I couldn't find it in the dap.txt.
Considered Alternatives
No response