pojokcodeid.nvim-lazy/lua/user/lsp/config.lua

38 lines
1,020 B
Lua
Raw Normal View History

2023-01-15 00:17:41 +07:00
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_ok then
return
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 = {}
2023-01-15 00:17:41 +07:00
local data_exists, custom_lsp = pcall(require, "core.config")
2023-02-19 17:46:32 +07:00
if data_exists then
for _, client in pairs(custom_lsp.lsp_installer) do
2023-02-19 17:46:32 +07:00
table.insert(servers, client)
end
end
2023-01-15 00:17:41 +07:00
lsp_installer.setup({
ensure_installed = servers,
})
for _, server in pairs(servers) do
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)
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" },
-- })