Install some default lsp servers

This commit is contained in:
Price Hiller 2022-01-15 19:31:10 -06:00
parent 836528db95
commit 4daa257f8d

View File

@ -1,17 +1,37 @@
local lsp_installer = require("nvim-lsp-installer") local lsp_installer = require("nvim-lsp-installer")
local async = require("plenary.async") local async = require("plenary.async")
local required_servers = {
"sumneko_lua",
"rust_analyzer",
"bashls",
"eslint",
"dockerls",
"yamlls",
}
for _, name in pairs(required_servers) do
local server_is_found, server = lsp_installer.get_server(name)
if server_is_found then
if not server:is_installed() then
async.run(function()
vim.notify.async("Installing Language Server " .. name, "info", {
title = "Lsp Installer",
}
)
end)
server:install()
end
end
end
local function on_attach(client, bufnr) local function on_attach(client, bufnr)
async.run(function() async.run(function()
vim.notify.async( vim.notify.async("Attached server " .. client.name, "info", {
"Attached server " .. client.name, title = "Lsp Attach",
"info", }).close()
{
title = "lsp"
}
).close()
end) end)
end end
lsp_installer.on_server_ready(function(server) lsp_installer.on_server_ready(function(server)
local opts = { local opts = {