From 0022142db00e7573c5d2d7eb88bf50979c9962a0 Mon Sep 17 00:00:00 2001 From: qizidog <451559450@qq.com> Date: Fri, 2 May 2025 15:55:40 +0800 Subject: [PATCH 1/2] feat(lang.python): supprot loading python path configured in neoconf --- lua/lazyvim/plugins/extras/lang/python.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 4c098452..cc450b54 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -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, }, }, From f7fa768cf146663637ef9ad6e5a74027d9b97439 Mon Sep 17 00:00:00 2001 From: qizidog <451559450@qq.com> Date: Fri, 2 May 2025 16:40:12 +0800 Subject: [PATCH 2/2] fix quotation mark --- lua/lazyvim/plugins/extras/lang/python.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index cc450b54..805a27d9 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -113,7 +113,7 @@ return { 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 }) + require("dap-python").setup(nil, { pythonPath = pypath }) return end end