mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(lang.python): supprot loading python path configured in neoconf
This commit is contained in:
parent
3f034d0a7f
commit
0022142db0
1 changed files with 12 additions and 2 deletions
|
|
@ -105,9 +105,19 @@ return {
|
|||
config = function()
|
||||
if vim.fn.has("win32") == 1 then
|
||||
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe"))
|
||||
else
|
||||
require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python"))
|
||||
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,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue