emacs-lsp / dap-mode

Emacs :heart: Debug Adapter Protocol
https://emacs-lsp.github.io/dap-mode
GNU General Public License v3.0
1.31k stars 182 forks source link

Close output window after disconnect #439

Open FlexW opened 3 years ago

FlexW commented 3 years ago

Thank you for making this package!

I have a little problem:

After disconnecting from a debugging session with dap-disconnect all buffers that were opened by dap-debug except for the output buffer get closed. It would be great if the output window would get also hidden or if there were at least a option for that.

blandinw commented 2 years ago

You can add a :cleanup-function to your template, like so:

(dap-register-debug-template
      "LLDB Zig"
      (list :type "lldb-vscode"
            :cwd (projectile-project-root)
            :request "launch"
            :args (list "-Q")
            :program "zig-out/bin/main"
            :name "LLDB Zig"
            :cleanup-function (lambda (sesh)
                                (when (not (dap--session-running sesh))
                                  (kill-buffer (dap--debug-session-output-buffer sesh))))))
simurgh9 commented 2 years ago

@blandinw Is there a way to kill all the buffers opened by dap-debug the same way?