mfussenegger / nvim-dap-python

An extension for nvim-dap, providing default configurations for python and methods to debug individual test methods or classes.
GNU General Public License v3.0
571 stars 51 forks source link

nvim-dap-ui is crashing when opening at the start #98

Closed robertsawko closed 1 year ago

robertsawko commented 1 year ago

Hello,

Many thanks for these fantastic DAP plugins. I am still pretty new to it and learning how it all works whilst setting it up for all languages that I am using.

I came across an issue, which may already be resolved elsewhere. I am looking for a good way integrating this plugin with nvim-dap-ui. For other languages I was using this remap to start my debugging session.

nnoremap("<F5>", function()
  dap.continue()
  dapui.open()
end)

When using the defaults of nvim-dap-python and pointing to the environment, I would get the following error:

E5108: Error executing lua: ...ck/packer/start/nvim-dap-ui/lua/dapui/windows/layout.lua:184: Invalid window id: 1007
stack traceback:
        [C]: in function 'nvim_win_set_option'
        ...ck/packer/start/nvim-dap-ui/lua/dapui/windows/layout.lua:184: in function '_init_win_settings'
        ...ck/packer/start/nvim-dap-ui/lua/dapui/windows/layout.lua:37: in function 'open'
        ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/init.lua:288: in function 'cb'
        ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/init.lua:214: in function 'keep_cmdheight'
        ...im/site/pack/packer/start/nvim-dap-ui/lua/dapui/init.lua:266: in function 'open'
        /home/rms/.config/nvim/after/plugin/debugger/init.lua:60: in function </home/rms/.config/nvim/after/plugin/debugger/init.lua:58>

This is probably caused by interaction with the menu, which asks whether to launch, launch with argument, attach remote etc. This is a very useful menu and I'd like to retain it, but is there a better way to integrate it with the UI after? If I comment dapui.open() and reopen manually whilst the session is running, it all works as expected.

Please let me know. For now, I am not opening the UI by default and just mapped a new binding for opening/closing it.

mfussenegger commented 1 year ago

I'd assume that nvim-dap-ui should handle the case that dap.continue() can work async and may open floating windows.

I don't think there's anything to do in nvim-dap-python about this.