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,5 +1,6 @@
local servers = {} local function get_all_servers()
for _, lang in pairs(Languages) do local servers = {}
for _, lang in pairs(Languages) do
if not lang.lsp then if not lang.lsp then
goto continue goto continue
end end
@ -7,6 +8,8 @@ for _, lang in pairs(Languages) do
servers[name] = vim.tbl_deep_extend("force", servers[name] or {}, conf) servers[name] = vim.tbl_deep_extend("force", servers[name] or {}, conf)
end end
::continue:: ::continue::
end
return servers
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/