Skip to content

Commit 82f9e6e

Browse files
committed
add fix for deprecated Mason setup, adds back LSP settings
applies patch from nvim-lua#1475 , should be altered to the upstream version when it propagates down to kickstar-modular
1 parent 8cce409 commit 82f9e6e

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

lua/kickstart/plugins/lspconfig.lua

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,6 @@ return {
192192
},
193193
}
194194

195-
-- LSP servers and clients are able to communicate to each other what features they support.
196-
-- By default, Neovim doesn't support everything that is in the LSP specification.
197-
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
198-
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
199-
local capabilities = require('blink.cmp').get_lsp_capabilities()
200-
201195
-- Enable the following language servers
202196
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
203197
--
@@ -244,6 +238,12 @@ return {
244238
},
245239
}
246240

241+
---@type MasonLspconfigSettings
242+
---@diagnostic disable-next-line: missing-fields
243+
require('mason-lspconfig').setup {
244+
automatic_enable = vim.tbl_keys(servers or {}),
245+
}
246+
247247
-- Ensure the servers and tools above are installed
248248
--
249249
-- To check the current status of installed tools and/or manually install
@@ -263,20 +263,13 @@ return {
263263
})
264264
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
265265

266-
require('mason-lspconfig').setup {
267-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
268-
automatic_installation = false,
269-
handlers = {
270-
function(server_name)
271-
local server = servers[server_name] or {}
272-
-- This handles overriding only values explicitly passed
273-
-- by the server configuration above. Useful when disabling
274-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
275-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
276-
require('lspconfig')[server_name].setup(server)
277-
end,
278-
},
279-
}
266+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
267+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
268+
for server_name, config in pairs(servers) do
269+
vim.lsp.config(server_name, config)
270+
end
271+
-- 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
272+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
280273
end,
281274
},
282275
}

0 commit comments

Comments
 (0)