mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.09k stars 179 forks source link

Remove executable from adapter when request type is attach #1273

Closed jsternberg closed 6 days ago

jsternberg commented 6 days ago

Related to https://github.com/leoluz/nvim-dap-go/issues/35. When attempting to attach to a remote dlv process, the nvim-dap-go plugin would attempt to launch an executable on the same port it was supposed to connect to. This would fail and would cause the plugin not to attach to the existingøØrt.

This is because nvim-dap-go switched to using the included adapter and the adapter does not check if the request is launch or attach before attempting to launch the dlv process.

This is fixed by removing executable from the adapter if the config uses attach since an attach request shouldn't be launching an executable anyway.

mfussenegger commented 6 days ago

Thanks for the PR but this is the wrong fix and would end up breaking other adapters.

Adapters tend to treat remote access in one of two ways:

The proper fix would be to change the adapter configuration that nvim-dap-go is making, similar to the one used in nvim-dap-python:

https://github.com/mfussenegger/nvim-dap-python/blob/d777c2b32ed39f61209c09bede28d7491621a631/lua/dap-python.lua#L208-L234

jsternberg commented 6 days ago

Thanks for the direction. I'll do that instead.