Automating install of pylsp plugins #908
Unanswered
matthewsia98
asked this question in
Q&A
Replies: 2 comments 11 replies
-
Hey! The pkg:install():once("closed", function ()
if not pkg:is_installed() then
-- installation failed
return
end
vim.fn.system({
"~/.local/share/nvim/mason/packages/python-lsp-server/venv/bin/python",
"-m",
"pip",
"install",
"pylsp-mypy",
"pyls-isort",
"python-lsp-black",
"pylsp-rope",
"python-lsp-ruff",
})
end) |
Beta Was this translation helpful? Give feedback.
9 replies
-
Just for future reference, for lazy (or lazyvim) it's better using the {
"williamboman/mason.nvim",
init = function(_)
local pylsp = require("mason-registry").get_package("python-lsp-server")
pylsp:on("install:success", function()
local function mason_package_path(package)
local path = vim.fn.resolve(vim.fn.stdpath("data") .. "/mason/packages/" .. package)
return path
end
local path = mason_package_path("python-lsp-server")
local command = path .. "/venv/bin/pip"
local args = {
"install",
"-U",
"pylsp-rope",
"python-lsp-black",
"python-lsp-isort",
"python-lsp-ruff",
"pyls-memestra",
"pylsp-mypy",
}
require("plenary.job")
:new({
command = command,
args = args,
cwd = path,
})
:start()
end)
end,
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I install pylsp plugins into the pylsp venv automatically?
I tried the following but it did not work.
I think this should work if I can ensure that the install for pylsp is synchronous.
Am I able to do that?
Beta Was this translation helpful? Give feedback.
All reactions