chore(nvim): clean up lsp configuration
This commit is contained in:
parent
506b1d3286
commit
396fab57da
|
@ -1,37 +1,28 @@
|
||||||
local has_lsp, lspconfig = pcall(require, "lspconfig")
|
--local has_lsp, lspconfig = pcall(require, "lspconfig")
|
||||||
|
|
||||||
local servers = {
|
local function config(_config)
|
||||||
ansiblels = true,
|
return vim.tbl_deep_extend("force", {
|
||||||
bashls = true,
|
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
cssls = true,
|
}, _config or {})
|
||||||
html = true,
|
|
||||||
|
|
||||||
intelephense = {
|
|
||||||
filetypes = { "install", "inc", "module", "php", "test", "theme" }
|
|
||||||
},
|
|
||||||
|
|
||||||
tsserver = {
|
|
||||||
filetypes = { "js", "jsx", "typescript", "vue" }
|
|
||||||
},
|
|
||||||
|
|
||||||
yamlls = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local setup_server = function(server, config)
|
|
||||||
if not config then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(config) ~= "table" then
|
|
||||||
config = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
lspconfig[server].setup(config)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for server, config in pairs(servers) do
|
require'lspconfig'.ansiblels.setup(config())
|
||||||
setup_server(server, config)
|
|
||||||
end
|
require'lspconfig'.bashls.setup(config())
|
||||||
|
|
||||||
|
require'lspconfig'.cssls.setup(config())
|
||||||
|
|
||||||
|
require'lspconfig'.html.setup(config())
|
||||||
|
|
||||||
|
require'lspconfig'.intelephense.setup(config({
|
||||||
|
filetypes = { "php", "test", "theme" }
|
||||||
|
}))
|
||||||
|
|
||||||
|
require'lspconfig'.tsserver.setup(config({
|
||||||
|
filetypes = { "javascript", "typescript", "vue" }
|
||||||
|
}))
|
||||||
|
|
||||||
|
require'lspconfig'.yamlls.setup(config())
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
|
Loading…
Reference in a new issue