Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit 96e7221

Browse files
committed
fixed mason lspconfig
See nvim-lua#1475
1 parent bc18855 commit 96e7221

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

init.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,13 @@ require('lazy').setup({
681681
},
682682
},
683683
}
684+
685+
---@type MasonLspconfigSettings
686+
---@diagnostic disable-next-line: missing-fields
687+
require('mason-lspconfig').setup {
688+
automatic_enable = vim.tbl_keys(servers or {}),
689+
}
690+
684691
-- Ensure the servers and tools above are installed
685692
--
686693
-- To check the current status of installed tools and/or manually install
@@ -700,18 +707,11 @@ require('lazy').setup({
700707
})
701708
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
702709

703-
require('mason-lspconfig').setup {
704-
handlers = {
705-
function(server_name)
706-
local server = servers[server_name] or {}
707-
-- This handles overriding only values explicitly passed
708-
-- by the server configuration above. Useful when disabling
709-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
710-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
711-
require('lspconfig')[server_name].setup(server)
712-
end,
713-
},
714-
}
710+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
711+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
712+
for server_name, config in pairs(servers) do
713+
vim.lsp.config(server_name, config)
714+
end
715715
end,
716716
},
717717
{ -- Autoformat

0 commit comments

Comments
 (0)