Update handling of LS dependencies

This commit is contained in:
2023-09-05 19:34:05 +02:00
committed by GitHub
parent eb1da79e6f
commit 3d87f08761
6 changed files with 39 additions and 4 deletions
+22 -1
View File
@@ -271,7 +271,28 @@ function P.language_servers(self)
if #not_installed > 0 then if #not_installed > 0 then
utils.warn( utils.warn(
("Disabling %s because the following required package(s) is not installed: %s"):format( ("Disabling %s because the following required package(s) are not installed: %s"):format(
name,
table.concat(not_installed, ", ")
),
module_name
)
server.enabled = false
goto next_server
end
end
if server.py_module_deps ~= nil then
local not_installed = {}
for _, mod in ipairs(server.py_module_deps) do
if not utils.python3_module_is_installed(mod) then
table.insert(not_installed, mod)
end
end
if #not_installed > 0 then
utils.warn(
("Disabling %s because the following required python3 module(s) are not installed: %s"):format(
name, name,
table.concat(not_installed, ", ") table.concat(not_installed, ", ")
), ),
-1
View File
@@ -18,7 +18,6 @@ return {
enabled = true, enabled = true,
dependencies = { dependencies = {
"npm", "npm",
"shellcheck",
}, },
lspconfig = { lspconfig = {
filetypes = { filetypes = {
+3
View File
@@ -16,6 +16,9 @@
return { return {
enabled = true, enabled = true,
py_module_deps = {
"venv",
},
lspconfig = { lspconfig = {
filetypes = { filetypes = {
"cmake", "cmake",
+3
View File
@@ -16,6 +16,9 @@
return { return {
enabled = true, enabled = true,
dependencies = {
"java",
},
lspconfig = { lspconfig = {
filetypes = { filetypes = {
"groovy", "groovy",
+3
View File
@@ -16,6 +16,9 @@
return { return {
enabled = true, enabled = true,
py_module_deps = {
"venv",
},
lspconfig = { lspconfig = {
filetypes = { filetypes = {
"python", "python",
+8 -2
View File
@@ -58,9 +58,15 @@ end
--- Asserts that a python module is installed --- Asserts that a python module is installed
---@param mod string: The python module to check ---@param mod string: The python module to check
function M.assert_python3_module_installed(mod) function M.python3_module_is_installed(mod)
local resp = vim.system({ "python3", "-m", "pip", "show", mod, }):wait() local resp = vim.system({ "python3", "-m", "pip", "show", mod, }):wait()
if not resp.code == 0 then return resp.code == 0
end
--- Asserts that a python module is installed
---@param mod string: The python module to check
function M.assert_python3_module_installed(mod)
if not M.python3_module_is_installed(mod) then
error("Python3 module " .. mod .. " not installed:\n" .. resp.stdout .. "\n" .. resp.stderr) error("Python3 module " .. mod .. " not installed:\n" .. resp.stdout .. "\n" .. resp.stderr)
end end
end end