diff --git a/init.lua b/init.lua index 2c1a01c4..867c6bc9 100644 --- a/init.lua +++ b/init.lua @@ -474,8 +474,8 @@ require('lazy').setup({ -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'williamboman/mason.nvim', version = 'v1.*', opts = {} }, - { 'williamboman/mason-lspconfig.nvim', version = 'v1.*' }, + { 'williamboman/mason.nvim', opts = {} }, + { 'williamboman/mason-lspconfig.nvim', opts = {} }, 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. @@ -705,34 +705,14 @@ require('lazy').setup({ }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, - handlers = { - function(server_name) - local config = servers[server_name] or {} - vim.lsp.config(server_name, config) - vim.lsp.enable(server_name) - end, - }, - } - -- NOTE: Some servers still require the nvim-lspconfig setup until they are updated - -- Add this template inside the handler function after initializing config if you encounter issues with any lsp - -- - -- if server_name == 'example_server' or server_name == 'example_server2' then - -- -- This handles overriding only values explicitly passed - -- -- by the server configuration above. Useful when disabling - -- -- certain features of an LSP (for example, turning off formatting for ts_ls) - -- local capabilities = require('blink.cmp').get_lsp_capabilities() - -- config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {}) - -- require('mason-lspconfig')[server_name].setup(config) - -- return - -- end - -- - -- LSP servers and clients are able to communicate to each other what features they support. - -- With nvim-lspconfig setup, Neovim doesn't support everything that is in the LSP specification. - -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + -- Installed LSPs are configured and enabled automatically with mason-lspconfig + -- The loop below is for overriding the default configuration of LSPs with the ones in the servers table + for server_name, config in pairs(servers) do + vim.lsp.config(server_name, config) + end + + -- 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 + -- These servers will have to be manually set up with require("lspconfig").server_name.setup{} end, },