Skip to content

Commit 2887507

Browse files
committed
Update config nvim-lua#1475
1 parent 03ce385 commit 2887507

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

init.lua

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -687,12 +687,6 @@ require('lazy').setup({
687687
},
688688
}
689689

690-
-- LSP servers and clients are able to communicate to each other what features they support.
691-
-- By default, Neovim doesn't support everything that is in the LSP specification.
692-
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
693-
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
694-
local capabilities = require('blink.cmp').get_lsp_capabilities()
695-
696690
-- Enable the following language servers
697691
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
698692
--
@@ -726,7 +720,11 @@ require('lazy').setup({
726720
},
727721
}
728722

729-
local lspconfig = require 'lspconfig'
723+
---@type MasonLspconfigSettings
724+
---@diagnostic disable-next-line: missing-fields
725+
require('mason-lspconfig').setup {
726+
automatic_enable = vim.tbl_keys(servers or {}),
727+
}
730728

731729
-- Ensure the servers and tools above are installed
732730
--
@@ -747,31 +745,15 @@ require('lazy').setup({
747745
})
748746
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
749747

750-
require('mason-lspconfig').setup {
751-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
752-
automatic_installation = false,
753-
handlers = {
754-
function(server_name)
755-
local server = servers[server_name] or {}
756-
-- This handles overriding only values explicitly passed
757-
-- by the server configuration above. Useful when disabling
758-
-- certain features of an LSP (for example, turning off formatting for ts_ls)
759-
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
760-
lspconfig[server_name].setup(server)
761-
end,
762-
},
763-
}
748+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
749+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
750+
for server_name, config in pairs(servers) do
751+
vim.lsp.config(server_name, config)
752+
end
764753

765-
lspconfig.sourcekit.setup {
766-
capabilities = {
767-
workspace = {
768-
didChangeWatchedFiles = {
769-
dyanamicRegistration = true,
770-
},
771-
},
772-
},
773-
}
774-
end,
754+
-- 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
755+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
756+
end,
775757
},
776758

777759
{ -- Autoformat

0 commit comments

Comments
 (0)