mirror of
https://github.com/aminnairi/dotfiles.git
synced 2026-09-14 15:42:14 +02:00
factorizing the lsp setup
This commit is contained in:
@@ -120,124 +120,28 @@ return {
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig.lua_ls.setup({
|
local languageServers = {
|
||||||
capabilities = capabilities,
|
lua_ls = {},
|
||||||
on_attach = on_attach,
|
tsserver = {},
|
||||||
on_init = function(client)
|
volar = {},
|
||||||
local path = client.workspace_folders[1].name
|
cssls = {},
|
||||||
if not vim.loop.fs_stat(path .. '/.luarc.json') and not vim.loop.fs_stat(path .. '/.luarc.jsonc') then
|
cssmodules_ls = {},
|
||||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
|
prismals = {},
|
||||||
Lua = {
|
yamlls = {},
|
||||||
runtime = {
|
marksman = {},
|
||||||
-- Tell the language server which version of Lua you're using
|
eslint = {},
|
||||||
-- (most likely LuaJIT in the case of Neovim)
|
dockerls = {},
|
||||||
version = 'LuaJIT'
|
rust_analyzer = {},
|
||||||
},
|
intelephense = {},
|
||||||
diagnostics = {
|
elmls = {}
|
||||||
globals = {
|
}
|
||||||
"vim"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- Make the server aware of Neovim runtime files
|
|
||||||
workspace = {
|
|
||||||
checkThirdParty = false,
|
|
||||||
library = {
|
|
||||||
vim.env.VIMRUNTIME
|
|
||||||
-- "${3rd}/luv/library"
|
|
||||||
-- "${3rd}/busted/library",
|
|
||||||
}
|
|
||||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
|
||||||
-- library = vim.api.nvim_get_runtime_file("", true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
for languageServer, languageServerSettings in pairs(languageServers) do
|
||||||
end
|
lspconfig[languageServer].setup({
|
||||||
return true
|
capabilities = capabilities,
|
||||||
end
|
on_attach = on_attach,
|
||||||
})
|
settings = languageServerSettings
|
||||||
|
})
|
||||||
lspconfig.tsserver.setup({
|
end
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.volar.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = {
|
|
||||||
"vue",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.cssls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = {
|
|
||||||
"css",
|
|
||||||
"scss",
|
|
||||||
"sass",
|
|
||||||
"less",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.cssmodules_ls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = {
|
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
|
||||||
"typescript",
|
|
||||||
"typescriptreact",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.prismals.setup({
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = {
|
|
||||||
"prisma",
|
|
||||||
},
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.yamlls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
filetypes = {
|
|
||||||
"yaml",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.marksman.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
filetypes = {
|
|
||||||
"markdown",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.eslint.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.dockerls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.rust_analyzer.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.intelephense.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.elmls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user