Files
work/term/.config/nvim/lua/plugins/debug-python.lua
T

70 lines
1.6 KiB
Lua

---@diagnostic disable: missing-fields
return {
{
"mfussenegger/nvim-dap-python",
dependencies = "mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
require("dap-python").setup()
dap.configurations.python = {
{
type = "python",
request = "launch",
name = "Launch file",
program = "${file}",
pythonPath = function()
return vim.fn.exepath("python3") or "python"
end,
},
{
type = "python",
request = "launch",
name = "Debug current file (integrated terminal)",
program = "${file}",
console = "integratedTerminal",
pythonPath = function()
return vim.fn.exepath("python3") or "python"
end,
},
{
type = "python",
request = "launch",
name = "Debug with arguments",
program = "${file}",
args = function()
local args = vim.fn.input("Args: ", ""):split(" ")
return args
end,
console = "integratedTerminal",
pythonPath = function()
return vim.fn.exepath("python3") or "python"
end,
},
{
type = "python",
request = "launch",
name = "Debug test_api.py",
module = "unittest",
args = { "test.test_api", "-v" },
cwd = "${workspaceFolder}",
pythonPath = function()
return vim.fn.exepath("python3") or "python"
end,
},
{
type = "python",
request = "launch",
name = "Debug all tests",
module = "unittest",
args = { "discover", "-s", "test", "-v" },
cwd = "${workspaceFolder}",
pythonPath = function()
return vim.fn.exepath("python3") or "python"
end,
},
}
end,
},
}