Skip to content

Commit 55bd808

Browse files
committed
add support for new LSP config API in Neovim 0.11+
Based on nvim-lua#1475
1 parent 477963a commit 55bd808

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

lua/kickstart/plugins/lspconfig.lua

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ return {
2121
-- Mason must be loaded before its dependents so we need to set it up here.
2222
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
2323
{ 'mason-org/mason.nvim', opts = {} },
24-
'mason-org/mason-lspconfig.nvim',
24+
{ 'mason-org/mason-lspconfig.nvim', opts = {} },
2525
'WhoIsSethDaniel/mason-tool-installer.nvim',
2626

2727
-- Useful status updates for LSP.
@@ -313,20 +313,14 @@ return {
313313
})
314314
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
315315

316-
require('mason-lspconfig').setup {
317-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
318-
automatic_installation = false,
319-
handlers = {
320-
function(server_name)
321-
local server = servers[server_name] or {}
322-
-- This handles overriding only values explicitly passed
323-
-- by the server configuration above. Useful when disabling
324-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
325-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
326-
require('lspconfig')[server_name].setup(server)
327-
end,
328-
},
329-
}
316+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
317+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
318+
for server_name, config in pairs(servers) do
319+
vim.lsp.config(server_name, config)
320+
end
321+
322+
-- 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
323+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
330324
end,
331325
},
332326
}

0 commit comments

Comments
 (0)