Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues getting started with debugpy - unable to launch debug session #45

Open
bavalpey opened this issue Nov 4, 2021 · 5 comments
Open

Comments

@bavalpey
Copy link

bavalpey commented Nov 4, 2021

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.

@pocco81
Copy link
Owner

pocco81 commented Nov 4, 2021

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:

  1. Try without passing any config, just let DAPInstall use the default config.
  2. Try 1 + instead of putting the snippet above under ftplugin/, put it under lua/ and make your package manager load nvim-dap, then DAPInstall and then this config.
  3. Try 1 and 2 + using the current config from nvim-dap.

@bavalpey
Copy link
Author

bavalpey commented Nov 4, 2021

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?

@pocco81
Copy link
Owner

pocco81 commented Nov 5, 2021

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 :)

@ByteDrummer
Copy link

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?

@ByteDrummer
Copy link

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.

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

No branches or pull requests

3 participants