Merge branch 'python-path-neoconf'

This commit is contained in:
akioweh 2025-07-28 18:32:57 +04:00
commit 81b1f01d4d
No known key found for this signature in database

View file

@ -103,7 +103,21 @@ return {
{ "<leader>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,
},
},