Skip to content

Conversation

@tomtomjhj
Copy link
Contributor

Problem:
If the debug adapter doesn't have supportsTerminateRequest capability (e.g., OpenDebugAD7 from cpptools), terminating the debuggy doesn't fire "terminated" event. So the terminal buffer for debuggy is not deleted by dap-view's event handler, and remains pooled by nvim-dap. A subsequent session reuses this terminal buffer, which is not expected by dap-view's terminal lifecycle management. As a result the user ends up seeing empty buffer created by dap-view, while the actual terminal buffer is hidden.

Solution:
Reuse the cleanup logic of the "terminated"-handler on "disconnect"-handler.

Problem:
If the debug adapter doesn't have supportsTerminateRequest capability
(e.g., OpenDebugAD7 from cpptools), terminating the debuggy doesn't fire
"terminated" event. So the terminal buffer for debuggy is not deleted by
dap-view's event handler, and remains pooled by nvim-dap. A subsequent
session reuses this terminal buffer, which is not expected by dap-view's
terminal lifecycle management. As a result the user ends up seeing empty
buffer created by dap-view, while the actual terminal buffer is hidden.

Solution:
Reuse the cleanup logic of the "terminated"-handler on
"disconnect"-handler.
@igorlfs
Copy link
Owner

igorlfs commented Aug 30, 2025

Hello,

Have you seen #108? It aims to let nvim-dap handle the terminal buffer lifecycle on its own. I'm not sure if it would fix this specific issue, but any fixes should go to that branch

@tomtomjhj
Copy link
Contributor Author

The problem seems to be fixed by #108. Thanks!

@tomtomjhj tomtomjhj closed this Sep 1, 2025
@tomtomjhj tomtomjhj deleted the cleanup-disconnect branch September 1, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants