Open xbot opened 2 years ago
Can you provide a debug log for nvim-dap? I believe this is because the debugger is not emitting the required events
I have the exact same issue... If I use my configure shortcut to terminate the debugging session the debuggee process is really terminated, but the windows do not disappear... The important parts of the configuration look like this:
local dap = require('dap')
dap.adapters.php = {
type = 'executable',
command = 'node',
args = { vim.fn.stdpath('data') .. '/mason/packages/php-debug-adapter/extension/out/phpDebug.js' },
}
dap.configurations.php = {
{
type = 'php',
request = 'launch',
name = 'Listen for Xdebug',
port = os.getenv('NVIM_XDEBUG_PORT'),
pathMappings = {
[os.getenv('NVIM_XDEBUG_PATH_SERVER')] = os.getenv('NVIM_XDEBUG_PATH_LOCAL'),
},
},
}
vim.keymap.set('n', '<F2>', dap.step_over)
vim.keymap.set('n', '<F3>', dap.step_into)
vim.keymap.set('n', '<F4>', dap.step_out)
vim.keymap.set('n', '<F5>', dap.continue)
vim.keymap.set('n', '<F6>', dap.terminate)
vim.keymap.set('n', '<F10>', dap.toggle_breakpoint)
local dapui = require('dapui')
dapui.setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
The first listener to open the UI works, but when I press F6 to terminate the session the UI windows remain...
I've checked the log, but it seems like today there was no error or anything else indicating a malfunction of nvim-dap
:
[ INFO ] 2022-10-31T08:43:14Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:43:14Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:43:14Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 59467 false
[ INFO ] 2022-10-31T08:45:21Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:45:21Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:45:21Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 62681 false
[ INFO ] 2022-10-31T08:46:09Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:46:09Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:46:09Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 62973 false
[ INFO ] 2022-10-31T08:49:51Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:49:51Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:49:51Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63154 false
[ INFO ] 2022-10-31T08:49:58Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:49:58Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:49:58Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63164 false
[ INFO ] 2022-10-31T08:50:22Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:50:22Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:50:22Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63173 false
[ INFO ] 2022-10-31T08:51:38Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:51:38Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:51:38Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63198 false
[ INFO ] 2022-10-31T08:53:43Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:53:43Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:53:43Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63382 false
[ INFO ] 2022-10-31T08:53:57Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T08:53:57Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T08:53:57Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63406 false
[ INFO ] 2022-10-31T09:17:10Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1465 ] "Session closed due to disconnect"
[ INFO ] 2022-10-31T09:17:10Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1128 ] "Closed all handles"
[ INFO ] 2022-10-31T09:17:10Z+0100 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1131 ] "Process closed" 63991 false
same here, the debugger terminates but the events (dap.listeners.before.event_terminated, dap.listeners.before.event_exited) are never fired. The dap.listeners.after.event_initialized
event works as expected.
Can you add a listener for disconnect
to see if that works?
dap.listeners.before.disconnect["dapui_config"] = function() dapui.close() end
This works for me, but only if the session is terminated using dap.terminate
. If the program finishes normally the ui stays, but that's already good enough for me.
Is that only when using disconnect
or using event_terminated
and event_exited
as well?
I am only talking about disconnect
, the other two event did not work.
same here, the debugger terminates but the events (dap.listeners.before.event_terminated, dap.listeners.before.event_exited) are never fired. The
dap.listeners.after.event_initialized
event works as expected.
Same here. When using disconnect is working but with event_terminated and event_exited don't work.
I am experiencing a similar issue.
dap-repl
buffer closes (it does not).dap-repl
buffer and back to the script I'm debugging, the debugging menu panel, moves to the buffer containing the script (only a restart seems to resolve it).Here's a video showcasing points 1 and 2.
I expect that when the script exits, the dap-repl buffer closes (it does not).
The window is closing but the buffer is still exists and so is listed. This is expected, otherwise all REPL state would be erased when closing the window.
For some reason, if I switch to the dap-repl buffer and back to the script I'm debugging, the debugging menu panel, moves to the buffer containing the script (only a restart seems to resolve it).
Separate bug, could you please open a separate issue?
I am experiencing a similar issue.
1. I expect that when the script exits, the `dap-repl` buffer closes (it does not).
I use a command to close the dap-repl
after disconnect:
dap.listeners.after.disconnect["dapui_config"] = function() vim.cmd("lua require('dap').close()") vim.cmd("lua require('dap').clear_breakpoints()") vim.cmd("lua require('dap.repl').close()") end
I don't know if it is the best way but it works for me.
- For some reason, if I switch to the dap-repl buffer and back to the script I'm debugging, the debugging menu panel, moves to the buffer containing the script (only a restart seems to resolve it).
Maybe what I'm talking about is not the same thing, but have you tried to change the location of the controls to another window? I changed the controls panel to the console window, it appears to be working. I'm not saying that this is not a bug just showing a possible working around.
dapui.setup({ controls = { element = "console", } })
Same issue with my config and events here
Disconnect event is caught when calling dap.terminate
I configured vimrc according to the README.md, the windows show up when dap.continue() is executed, which is as expected.
But when dap.terminate() is executed, the windows do not close automatically.
The full configuration is as follows: