diff --git a/term/.config/nvim/lua/plugins/debug-python.lua b/term/.config/nvim/lua/plugins/debug-python.lua index 43bb73c..8f9941f 100644 --- a/term/.config/nvim/lua/plugins/debug-python.lua +++ b/term/.config/nvim/lua/plugins/debug-python.lua @@ -5,6 +5,7 @@ return { dependencies = "mfussenegger/nvim-dap", config = function() local dap = require("dap") + require("dap-python").setup() dap.configurations.python = { @@ -13,55 +14,46 @@ return { request = "launch", name = "Launch file", program = "${file}", - pythonPath = function() - return vim.fn.exepath("python3") or "python" - end, + cwd = "${workspaceFolder}", + env = { PYTHONPATH = "${workspaceFolder}" }, }, { type = "python", request = "launch", name = "Debug current file (integrated terminal)", program = "${file}", + cwd = "${workspaceFolder}", console = "integratedTerminal", - pythonPath = function() - return vim.fn.exepath("python3") or "python" - end, + env = { PYTHONPATH = "${workspaceFolder}" }, }, { type = "python", request = "launch", name = "Debug with arguments", program = "${file}", + cwd = "${workspaceFolder}", args = function() local args = vim.fn.input("Args: ", ""):split(" ") return args end, console = "integratedTerminal", - pythonPath = function() - return vim.fn.exepath("python3") or "python" - end, + env = { PYTHONPATH = "${workspaceFolder}" }, }, { 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, + args = { "test.test_api", "-v" }, }, { 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, + args = { "discover", "-s", "test", "-v" }, }, } end,