Skip to content

Commit fd918c4

Browse files
author
Niklaus Mosimann
committed
Fix: LSP configuration not loaded (see nvim-lua#1475)
1 parent e08e431 commit fd918c4

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

lua/kickstart/plugins/lspconfig.lua

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ return {
236236
},
237237
},
238238
}
239+
---@type MasonLspconfigSettings
240+
---@diagnostic disable-next-line: missing-fields
241+
require('mason-lspconfig').setup {
242+
automatic_enable = vim.tbl_keys(servers or {}),
243+
}
239244

240245
-- Ensure the servers and tools above are installed
241246
--
@@ -256,20 +261,14 @@ return {
256261
})
257262
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
258263

259-
require('mason-lspconfig').setup {
260-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
261-
automatic_installation = false,
262-
handlers = {
263-
function(server_name)
264-
local server = servers[server_name] or {}
265-
-- This handles overriding only values explicitly passed
266-
-- by the server configuration above. Useful when disabling
267-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
268-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
269-
require('lspconfig')[server_name].setup(server)
270-
end,
271-
},
272-
}
264+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
265+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
266+
for server_name, config in pairs(servers) do
267+
vim.lsp.config(server_name, config)
268+
end
269+
270+
-- NOTE: Some servers may require an old setup until they are updated. For the full list refer here: https://github.com/neovim/nvim-lspconfig/issues/3705
271+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
273272
end,
274273
},
275274
}

0 commit comments

Comments
 (0)