Skip to content

Commit 1fef7f5

Browse files
committed
Manual merge of PR nvim-lua#1475 upstream, from umutondersu/kickstart.nvim:master
This adds support for new LSP configuration API introduced in Neovim 0.11+ and updates Mason to version 2
1 parent 867066d commit 1fef7f5

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

init.lua

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -664,12 +664,6 @@ require('lazy').setup({
664664
},
665665
}
666666

667-
-- LSP servers and clients are able to communicate to each other what features they support.
668-
-- By default, Neovim doesn't support everything that is in the LSP specification.
669-
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
670-
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
671-
local capabilities = require('blink.cmp').get_lsp_capabilities()
672-
673667
-- Enable the following language servers
674668
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
675669
--
@@ -746,6 +740,11 @@ require('lazy').setup({
746740
-- prettier = {},
747741
-- sqlls = {},
748742
}
743+
---@type MasonLspconfigSettings
744+
---@diagnostic disable-next-line: missing-fields
745+
require('mason-lspconfig').setup {
746+
automatic_enable = vim.tbl_keys(servers or {}),
747+
}
749748

750749
-- Ensure the servers and tools above are installed
751750
--
@@ -767,23 +766,15 @@ require('lazy').setup({
767766
}
768767
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
769768

770-
require('mason-lspconfig').setup {
771-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
772-
automatic_installation = false,
773-
-- automatic_enable = false,
774-
handlers = {
775-
function(server_name)
776-
local server = servers[server_name] or {}
777-
-- This handles overriding only values explicitly passed
778-
-- by the server configuration above. Useful when disabling
779-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
780-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
781-
require('lspconfig')[server_name].setup(server)
782-
end,
783-
},
784-
}
769+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
770+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
771+
for server_name, config in pairs(servers) do
772+
vim.lsp.config(server_name, config)
773+
-- vim.lsp.enable(server_name)
774+
end
785775

786-
-- vim.lsp.enable 'postgres_lsp'
776+
-- 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
777+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
787778
end,
788779
},
789780

0 commit comments

Comments
 (0)