2023-01-15 00:17:41 +07:00
|
|
|
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
|
|
|
|
if not status_ok then
|
2024-06-25 05:41:42 +07:00
|
|
|
return
|
2023-01-15 00:17:41 +07:00
|
|
|
end
|
|
|
|
|
|
|
|
local lspconfig = require("lspconfig")
|
|
|
|
|
|
|
|
-- local servers = { "jsonls", "sumneko_lua","html","cssls","tsserver"}
|
2023-02-03 23:45:31 +07:00
|
|
|
-- local servers = { "jdtls", "yamlls" }
|
|
|
|
local servers = {}
|
2024-06-14 08:21:36 +07:00
|
|
|
local installer = pcode.lsp_installer or {}
|
2024-05-21 19:49:53 +07:00
|
|
|
for _, client in pairs(installer) do
|
2024-06-25 05:41:42 +07:00
|
|
|
table.insert(servers, client)
|
2023-02-19 17:46:32 +07:00
|
|
|
end
|
|
|
|
|
2023-01-15 00:17:41 +07:00
|
|
|
lsp_installer.setup({
|
2024-06-25 05:41:42 +07:00
|
|
|
ensure_installed = servers,
|
2023-01-15 00:17:41 +07:00
|
|
|
})
|
|
|
|
|
|
|
|
for _, server in pairs(servers) do
|
2024-06-25 05:41:42 +07:00
|
|
|
local opts = {
|
|
|
|
on_attach = require("user.lsp.handlers").on_attach,
|
|
|
|
capabilities = require("user.lsp.handlers").capabilities,
|
|
|
|
}
|
|
|
|
local has_custom_opts, server_custom_opts = pcall(require, "user.lsp.settings." .. server)
|
|
|
|
if has_custom_opts then
|
|
|
|
opts = vim.tbl_deep_extend("force", opts, server_custom_opts)
|
|
|
|
end
|
|
|
|
lspconfig[server].setup(opts)
|
2023-01-15 00:17:41 +07:00
|
|
|
end
|
2023-01-23 06:06:37 +07:00
|
|
|
|
2023-03-22 20:17:21 +07:00
|
|
|
-- lspconfig.yamlls.setup({
|
|
|
|
-- fletype = { "yaml", "yaml.docker-compose" },
|
|
|
|
-- })
|