Skip to content

Commit 0018683

Browse files
committed
feat(lsp): Update Mason to v2
1 parent 9e0c7b6 commit 0018683

File tree

1 file changed

+10
-30
lines changed

1 file changed

+10
-30
lines changed

init.lua

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ require('lazy').setup({
474474
-- Automatically install LSPs and related tools to stdpath for Neovim
475475
-- Mason must be loaded before its dependents so we need to set it up here.
476476
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
477-
{ 'williamboman/mason.nvim', version = 'v1.*', opts = {} },
478-
{ 'williamboman/mason-lspconfig.nvim', version = 'v1.*' },
477+
{ 'williamboman/mason.nvim', opts = {} },
478+
{ 'williamboman/mason-lspconfig.nvim', opts = {} },
479479
'WhoIsSethDaniel/mason-tool-installer.nvim',
480480

481481
-- Useful status updates for LSP.
@@ -705,34 +705,14 @@ require('lazy').setup({
705705
})
706706
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
707707

708-
require('mason-lspconfig').setup {
709-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
710-
automatic_installation = false,
711-
handlers = {
712-
function(server_name)
713-
local config = servers[server_name] or {}
714-
vim.lsp.config(server_name, config)
715-
vim.lsp.enable(server_name)
716-
end,
717-
},
718-
}
719-
-- NOTE: Some servers still require the nvim-lspconfig setup until they are updated
720-
-- Add this template inside the handler function after initializing config if you encounter issues with any lsp
721-
--
722-
-- if server_name == 'example_server' or server_name == 'example_server2' then
723-
-- -- This handles overriding only values explicitly passed
724-
-- -- by the server configuration above. Useful when disabling
725-
-- -- certain features of an LSP (for example, turning off formatting for ts_ls)
726-
-- local capabilities = require('blink.cmp').get_lsp_capabilities()
727-
-- config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
728-
-- require('mason-lspconfig')[server_name].setup(config)
729-
-- return
730-
-- end
731-
--
732-
-- LSP servers and clients are able to communicate to each other what features they support.
733-
-- With nvim-lspconfig setup, Neovim doesn't support everything that is in the LSP specification.
734-
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
735-
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
708+
-- Installed LSPs are configured and enabled automatically with mason-lspconfig
709+
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
710+
for server_name, config in pairs(servers) do
711+
vim.lsp.config(server_name, config)
712+
end
713+
714+
-- 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
715+
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{}
736716
end,
737717
},
738718

0 commit comments

Comments
 (0)