nvim: Change creating lsp servers into local function

This commit is contained in:
Marty Oehme 2025-06-05 10:04:21 +02:00
parent d2432e0039
commit 9900750e81
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -1,12 +1,15 @@
local servers = {} local function get_all_servers()
for _, lang in pairs(Languages) do local servers = {}
if not lang.lsp then for _, lang in pairs(Languages) do
goto continue if not lang.lsp then
goto continue
end
for name, conf in pairs(lang.lsp) do
servers[name] = vim.tbl_deep_extend("force", servers[name] or {}, conf)
end
::continue::
end end
for name, conf in pairs(lang.lsp) do return servers
servers[name] = vim.tbl_deep_extend("force", servers[name] or {}, conf)
end
::continue::
end end
local lsp = { local lsp = {
@ -27,7 +30,7 @@ local lsp = {
{ "saghen/blink.cmp", optional = true }, { "saghen/blink.cmp", optional = true },
}, },
event = { "BufReadPost", "BufNewFile", "BufWritePre" }, event = { "BufReadPost", "BufNewFile", "BufWritePre" },
opts = { servers = servers }, opts = { servers = get_all_servers() },
config = function(_, lspconfig_opts) config = function(_, lspconfig_opts)
-- Display diagnostics as virtual text only if not in insert mode -- Display diagnostics as virtual text only if not in insert mode
-- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/ -- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/