diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index f3aece61..c77702d4 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -103,7 +103,21 @@ return { { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, }, config = function() - require("dap-python").setup("debugpy-adapter") + if vim.fn.has("win32") == 1 then + require("dap-python").setup("debugpy-adapter") + return + end + -- try loading python path configured in neoconf (pyright) + if LazyVim.has("neoconf.nvim") and LazyVim.is_loaded("neoconf.nvim") then + local ncf = require("neoconf").get() + local pypath = ((ncf.lspconfig or {}).pyright or {})["python.pythonPath"] + if pypath ~= nil then + pypath = vim.fn.expand(pypath) + require("dap-python").setup(nil, { pythonPath = pypath }) + return + end + end + require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python")) end, }, },