nvim/lua/configs/lspconfig.lua
2024-09-29 17:55:18 +02:00

65 lines
1.4 KiB
Lua

local default = {
capabilities = require('cmp_nvim_lsp').default_capabilities()
}
local servers = {
java_language_server = { cmd = { "java-language-server" } },
ocamllsp = {},
pyright = {},
basedpyright = {},
lua_ls = {},
clangd = {},
ccls = {},
-- jedi_language_server = {},
nixd = {},
nil_ls = {},
typst_lsp = {
-- settings = {
-- exportPdf = "onType"
-- }
},
ltex = {
filetypes = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
settings = {
ltex = {
language = "fr",
enabled = { "latex", "typst", "typ", "bib", "markdown", "plaintex", "tex" },
},
},
},
elixirls = {
cmd = { "elixir-ls" },
},
rust_analyzer = {},
glslls = {
cmd = { "glslls", "--target-env", "opengl", "--stdin" },
},
}
local enabled = {}
for server, config in pairs(servers) do
local lsp = require("lspconfig")[server]
-- print(server)
local config = vim.tbl_deep_extend("keep", config, default, lsp.document_config.default_config)
if config.cmd ~= nil then
if vim.fn.executable(config.cmd[1]) == 1 then
enabled[server] = config
end
end
end
for server, config in pairs(enabled) do
local lsp = require("lspconfig")[server]
lsp.setup(config)
end
vim.diagnostic.config({
virtual_text = false,
-- signs = true,
underline = true,
-- update_in_insert = false,
-- severity_sort = false,
})