Fix basedpyright install failure on Debian
Debian ships venv's ensurepip in a separate python3-venv package. Without it, `python3 -m venv` exits 1, so mason cannot build the venv it installs basedpyright into, and mason-lspconfig reports a failed install on every startup. Add python3-venv to the apt package list, and guard the basedpyright entry in ensure_installed the same way the npm-sourced servers are already guarded, so a machine missing it gets one warning instead of a failed install every time.
This commit is contained in:
@@ -1,4 +1,21 @@
|
|||||||
local servers = { "basedpyright", "ruff" }
|
-- ruff is a prebuilt GitHub release binary, but mason installs basedpyright
|
||||||
|
-- from PyPI into a venv. Debian ships venv's ensurepip separately
|
||||||
|
-- (python3-venv), and without it every startup fails the install.
|
||||||
|
local servers = { "ruff" }
|
||||||
|
|
||||||
|
local function has_python_venv()
|
||||||
|
if vim.fn.executable("python3") ~= 1 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
vim.fn.system({ "python3", "-c", "import ensurepip" })
|
||||||
|
return vim.v.shell_error == 0
|
||||||
|
end
|
||||||
|
|
||||||
|
if has_python_venv() then
|
||||||
|
table.insert(servers, "basedpyright")
|
||||||
|
else
|
||||||
|
vim.notify("python3 venv unavailable (install python3-venv): skipping LSP server basedpyright", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
|
||||||
local npm_servers = { "ts_ls", "svelte", "html", "cssls", "bashls" }
|
local npm_servers = { "ts_ls", "svelte", "html", "cssls", "bashls" }
|
||||||
local function has_public_npm()
|
local function has_public_npm()
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ powerline
|
|||||||
thefuck
|
thefuck
|
||||||
tree
|
tree
|
||||||
nodejs
|
nodejs
|
||||||
|
# Debian splits venv's ensurepip out of python3; mason needs `python3 -m venv`
|
||||||
|
# to install PyPI-sourced LSP servers (basedpyright)
|
||||||
|
python3-venv
|
||||||
zsh
|
zsh
|
||||||
htop
|
htop
|
||||||
jq
|
jq
|
||||||
|
|||||||
Reference in New Issue
Block a user