Skip to content

Commit 981034a

Browse files
committed
chore: use new LSP config from nvim 0.11
Based on nvim-lua#1475
1 parent 5724562 commit 981034a

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

init.lua

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -613,12 +613,6 @@ require('lazy').setup({
613613
},
614614
}
615615

616-
-- LSP servers and clients are able to communicate to each other what features they support.
617-
-- By default, Neovim doesn't support everything that is in the LSP specification.
618-
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
619-
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
620-
local capabilities = require('blink.cmp').get_lsp_capabilities()
621-
622616
-- Enable the following language servers
623617
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
624618
--
@@ -657,12 +651,32 @@ require('lazy').setup({
657651
},
658652
},
659653
elixirls = {
660-
dialyzerEnabled = false,
654+
dialyzerEnabled = true,
661655
fetchDeps = false,
662656
},
663657
ts_ls = {},
664658
}
665659

660+
---@type MasonLspconfigSettings
661+
require('mason-lspconfig').setup {
662+
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
663+
-- NOTE: When the keys of servers are passed as a table to automatic_enable,
664+
-- it causes mason-lspconfig to ignore any LSPs that are installed via Mason
665+
-- but not explicitly listed in servers.
666+
-- https://github.com/nvim-lua/kickstart.nvim/pull/1475/files#r2094166972
667+
automatic_enable = vim.tbl_keys(servers or {}),
668+
-- TODO: remove this ?
669+
-- handlers = {
670+
-- function(server_name)
671+
-- local config = servers[server_name] or {}
672+
-- vim.lsp.config(server_name, config)
673+
-- -- It should not be necessary with Mason 2
674+
-- -- https://github.com/nvim-lua/kickstart.nvim/pull/1475#discussion_r2077249925
675+
-- -- vim.lsp.enable(server_name)
676+
-- end,
677+
-- },
678+
}
679+
666680
-- Ensure the servers and tools above are installed
667681
--
668682
-- To check the current status of installed tools and/or manually install
@@ -682,21 +696,14 @@ require('lazy').setup({
682696
'markdownlint', -- Used to format Markdown files
683697
})
684698
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
699+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
700+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
701+
for server_name, config in pairs(servers) do
702+
vim.lsp.config(server_name, config)
703+
end
685704

686-
require('mason-lspconfig').setup {
687-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
688-
automatic_installation = false,
689-
handlers = {
690-
function(server_name)
691-
local server = servers[server_name] or {}
692-
-- This handles overriding only values explicitly passed
693-
-- by the server configuration above. Useful when disabling
694-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
695-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
696-
require('lspconfig')[server_name].setup(server)
697-
end,
698-
},
699-
}
705+
-- 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
706+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
700707
end,
701708
},
702709

0 commit comments

Comments
 (0)