Install some default lsp servers
This commit is contained in:
parent
836528db95
commit
4daa257f8d
@ -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 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user