neovim-confs/lua/custom/configs/lspconfig.lua

115 lines
2.2 KiB
Lua

local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
-- if you just want default config for the servers then put them in a table
local servers = {
"html",
"cssls",
"tsserver",
"clangd",
"pyright",
-- "rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration!
"bashls",
"cmake",
"yamlls",
"textlsp",
"texlab",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
lspconfig.rust_analyzer.setup {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
check = {
command = "clippy",
},
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}
lspconfig.ltex.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
ltex = {
-- specific language (such as en-GB or de-DE is recommended, but I
-- want multilingual)
language = "en-GB",
enabled = {
-- I'm writing in german but the commands are in english,
-- does not really work
-- "bibtex",
-- "tex",
-- "latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
},
},
}
lspconfig.textlsp.setup {
on_attach = on_attach,
capabilities = capabilities,
filetypes = {
"bibtex",
"tex",
"latex",
"gitcommit",
"markdown",
"org",
"restructuredtext",
"rsweave",
"quarto",
"rmd",
"context",
"html",
"xhtml",
},
settings = {
textLSP = {
analysers = {
languagetool = {
check_text = {
on_change = false,
on_open = true,
on_save = true,
},
enabled = false,
},
},
},
},
}