Auto install lsp servers
This commit is contained in:
parent
8fabdb2d07
commit
31ca3a6d00
@ -77,6 +77,27 @@ local on_attach = function(client, bufnr)
|
||||
end
|
||||
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
|
||||
local servers = {
|
||||
"pyright",
|
||||
"cmake",
|
||||
"clangd",
|
||||
"jsonls",
|
||||
"groovyls",
|
||||
"sumneko_lua",
|
||||
"dockerls",
|
||||
}
|
||||
|
||||
for _, name in pairs(servers) do
|
||||
local server_is_found, server = lsp_installer.get_server(name)
|
||||
if server_is_found then
|
||||
if not server:is_installed() then
|
||||
print("Installing " .. name)
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {
|
||||
on_attach = on_attach,
|
||||
|
Loading…
x
Reference in New Issue
Block a user