fix: fixed conflicts + moving to yadm

This commit is contained in:
2026-02-20 17:21:21 +03:00
parent 03128d0bcf
commit b5f443916b
553 changed files with 704 additions and 256 deletions
+52
View File
@@ -0,0 +1,52 @@
-- source https://github.com/neovim/nvim-lspconfig/issues/500#issuecomment-877293306
local export = {}
local function shorten_path(path)
if not path or #path <= 1 then
return path or "/"
end
local last_slash = path:match(".*/()")
if last_slash and last_slash > 1 then
return path:sub(1, last_slash - 2)
else
return "/"
end
end
function export.get_python_path()
local util = require("lspconfig/util")
local path = util.path
workspace = vim.fn.expand("%:p")
-- Use activated virtualenv.
if vim.env.VIRTUAL_ENV then
return path.join(vim.env.VIRTUAL_ENV, "bin", "python")
end
local match = vim.fn.glob(path.join(workspace, ".venv"))
if match ~= "" then
return path.join(workspace, ".venv", "bin", "python")
end
-- Find and use virtualenv via poetry in workspace directory.
while workspace ~= "" do
if workspace ~= "" then
local match = vim.fn.glob(path.join(workspace, "poetry.lock"))
if match ~= "" then
vim.api.nvim_set_current_dir(workspace)
local venv = vim.fn.trim(vim.fn.system("poetry env info -p 2> /dev/null"))
if venv ~= "" then
return path.join(venv, "bin", "python")
end
end
end
workspace = shorten_path(workspace)
end
-- Fallback to system Python.
return vim.fn.exepath("python3") or vim.fn.exepath("python") or "python"
end
return export