Skip to content

Commit 9c99c4e

Browse files
committed
1 parent 3338d39 commit 9c99c4e

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

init.lua

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -655,12 +655,6 @@ require('lazy').setup({
655655
},
656656
}
657657

658-
-- LSP servers and clients are able to communicate to each other what features they support.
659-
-- By default, Neovim doesn't support everything that is in the LSP specification.
660-
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
661-
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
662-
local capabilities = require('blink.cmp').get_lsp_capabilities()
663-
664658
-- Enable the following language servers
665659
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
666660
--
@@ -699,6 +693,11 @@ require('lazy').setup({
699693
},
700694
},
701695
}
696+
---@type MasonLspconfigSettings
697+
---@diagnostic disable-next-line: missing-fields
698+
require('mason-lspconfig').setup {
699+
automatic_enable = vim.tbl_keys(servers or {}),
700+
}
702701

703702
-- Ensure the servers and tools above are installed
704703
--
@@ -719,20 +718,14 @@ require('lazy').setup({
719718
})
720719
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
721720

722-
require('mason-lspconfig').setup {
723-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
724-
automatic_installation = false,
725-
handlers = {
726-
function(server_name)
727-
local server = servers[server_name] or {}
728-
-- This handles overriding only values explicitly passed
729-
-- by the server configuration above. Useful when disabling
730-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
731-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
732-
require('lspconfig')[server_name].setup(server)
733-
end,
734-
},
735-
}
721+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
722+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
723+
for server_name, config in pairs(servers) do
724+
vim.lsp.config(server_name, config)
725+
end
726+
727+
-- 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
728+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
736729
end,
737730
},
738731

0 commit comments

Comments
 (0)