dap-buddy.nvim
dap-buddy.nvim copied to clipboard
Issues getting started with debugpy - unable to launch debug session
I've been using this plugin along with nvim-dap=ui and I'm having serious issues getting this working on a very simple example. I've put the settings to configure dap as mentioned in the README in ftplugin/python.lua
file: ftplugin/python.lua
local dap_install = require("dap-install")
dap_install.config(
"python",
{
adapters = {
type = "executable",
command = "python",
args = {"-m", "debugpy.adapter"}
},
configurations = {
{
type = "python",
request = "launch",
name = "Launch file",
program = "${file}",
pythonPath = function()
local vnv = os.getenv("VIRTUAL_ENV")
if vnv ~= nil and vim.fn.executable(vnv .. "/bin/python") then
return vnv .. "/bin/python"
else
return "/usr/bin/python"
end
end
}
}
}
)
I've created a hello_world python module, set a breakpoint, and called :lua require'dap'.continue()
After some time, that results in the following message:
Debug adapter didn't respond. Either the adapter is slow (then wait and ignore this) or there is a problem with your adapter or `python` configuration. Check the logs for errors (:help dap.set_log_level)
What am I doing wrong? How can I get this to be properly configured. It is also worth noting that I tried to just run the debugger out-of-the-box after running DIInstall, but this failed, stating that python was not configured.
Huh weird, it was the first debugger I got working. Keep in mind that configs are not "fetched", they are hard coded, so yeah if you did everything well then it's likely a problem with the config just being outdated.
So please:
- Try without passing any config, just let DAPInstall use the default config.
- Try 1 + instead of putting the snippet above under
ftplugin/
, put it underlua/
and make your package manager loadnvim-dap
, thenDAPInstall
and then this config. - Try 1 and 2 + using the current config from nvim-dap.
Hmm.. It's very strange to me; solution 1 just worked fine. Do you have any suggestions for configuring it to work when a virtual environment is actually active? Those relative path checks included in the default configuration are worthless.
Also, question, if I change the value of dap_install.config, will that effect the configuration of the debugger after it is installed? Or is the config applied only at time of install?
Also, question, if I change the value of dap_install.config, will that effect the configuration of the debugger after it is installed? Or is the config applied only at time of install?
neither, it's applied at runtime. Nvim-dap is the one in-charged of that, DAPInstall only hands the debuggers' config to it :)
I'm in the same boat. Only the default configuration works. Is there a way to print out this default config so we can try modifying that?
Setting dap.configurations.python
after calling dap_install.config("python", {})
works fine for me so I guess for now I'll do my configuration directly through nvim-dap.