fix python debugging
This commit is contained in:
@@ -5,6 +5,7 @@ return {
|
|||||||
dependencies = "mfussenegger/nvim-dap",
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
|
||||||
require("dap-python").setup()
|
require("dap-python").setup()
|
||||||
|
|
||||||
dap.configurations.python = {
|
dap.configurations.python = {
|
||||||
@@ -13,55 +14,46 @@ return {
|
|||||||
request = "launch",
|
request = "launch",
|
||||||
name = "Launch file",
|
name = "Launch file",
|
||||||
program = "${file}",
|
program = "${file}",
|
||||||
pythonPath = function()
|
cwd = "${workspaceFolder}",
|
||||||
return vim.fn.exepath("python3") or "python"
|
env = { PYTHONPATH = "${workspaceFolder}" },
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "python",
|
type = "python",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
name = "Debug current file (integrated terminal)",
|
name = "Debug current file (integrated terminal)",
|
||||||
program = "${file}",
|
program = "${file}",
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
console = "integratedTerminal",
|
console = "integratedTerminal",
|
||||||
pythonPath = function()
|
env = { PYTHONPATH = "${workspaceFolder}" },
|
||||||
return vim.fn.exepath("python3") or "python"
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "python",
|
type = "python",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
name = "Debug with arguments",
|
name = "Debug with arguments",
|
||||||
program = "${file}",
|
program = "${file}",
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
args = function()
|
args = function()
|
||||||
local args = vim.fn.input("Args: ", ""):split(" ")
|
local args = vim.fn.input("Args: ", ""):split(" ")
|
||||||
return args
|
return args
|
||||||
end,
|
end,
|
||||||
console = "integratedTerminal",
|
console = "integratedTerminal",
|
||||||
pythonPath = function()
|
env = { PYTHONPATH = "${workspaceFolder}" },
|
||||||
return vim.fn.exepath("python3") or "python"
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "python",
|
type = "python",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
name = "Debug test_api.py",
|
name = "Debug test_api.py",
|
||||||
module = "unittest",
|
module = "unittest",
|
||||||
args = { "test.test_api", "-v" },
|
|
||||||
cwd = "${workspaceFolder}",
|
cwd = "${workspaceFolder}",
|
||||||
pythonPath = function()
|
args = { "test.test_api", "-v" },
|
||||||
return vim.fn.exepath("python3") or "python"
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "python",
|
type = "python",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
name = "Debug all tests",
|
name = "Debug all tests",
|
||||||
module = "unittest",
|
module = "unittest",
|
||||||
args = { "discover", "-s", "test", "-v" },
|
|
||||||
cwd = "${workspaceFolder}",
|
cwd = "${workspaceFolder}",
|
||||||
pythonPath = function()
|
args = { "discover", "-s", "test", "-v" },
|
||||||
return vim.fn.exepath("python3") or "python"
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
|||||||
Reference in New Issue
Block a user