feat: attach to debug py

This commit is contained in:
Fabio Montefuscolo 2024-04-04 14:35:22 +02:00
parent 11aa5558aa
commit 28ebd31fb9
Signed by: fabiomontefuscolo
GPG key ID: 7598676DAE19B4EF
2 changed files with 18 additions and 2 deletions

View file

@ -35,7 +35,17 @@ M.dap_python = {
n = {
["<leader>dpr"] = {
function()
require('dap-python').test_method()
local dap = require('dap')
dap.run({
type = 'python',
request = 'attach',
name = 'Debugpy',
justMyCode = false,
connect = {
host = '127.0.0.1',
port = 5678,
}
})
end
}
}

View file

@ -16,6 +16,12 @@ local plugins = {
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
end
},
{
@ -34,7 +40,7 @@ local plugins = {
config = function(_, opts)
local pyenv = os.getenv("VIRTUAL_ENV") or "/usr"
local path = pyenv .. "/bin/python3"
require("dap-python").setup(path)
require("dap-python").setup(path, opts)
require("core.utils").load_mappings("dap_python")
end,
},