@@ -711,20 +711,34 @@ require('lazy').setup({
711711 })
712712 require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
713713
714- require (' mason-lspconfig' ).setup {
715- ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
716- automatic_installation = false ,
717- handlers = {
718- function (server_name )
719- local server = servers [server_name ] or {}
720- -- This handles overriding only values explicitly passed
721- -- by the server configuration above. Useful when disabling
722- -- certain features of an LSP (for example, turning off formatting for ts_ls)
723- server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
724- require (' lspconfig' )[server_name ].setup (server )
725- end ,
726- },
727- }
714+ -- Handle lsp setups differently based on Neovim version
715+ -- See :help vim.lsp.config and :help vim.lsp.enable for Neovim 0.11+
716+ if vim .fn .has ' nvim-0.11' == 1 then
717+ for server , config in pairs (servers ) do
718+ -- This handles overriding only values explicitly passed
719+ -- by the server configuration above. Useful when disabling
720+ -- certain features of an LSP (for example, turning off formatting for ts_ls)
721+ config .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
722+ vim .lsp .config (name , config )
723+ vim .lsp .enable (name )
724+ end
725+ else
726+ -- For Neovim 0.10 and below, use mason-lspconfig for setup
727+ require (' mason-lspconfig' ).setup {
728+ ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
729+ automatic_installation = false ,
730+ handlers = {
731+ function (server_name )
732+ local server = servers [server_name ] or {}
733+ -- This handles overriding only values explicitly passed
734+ -- by the server configuration above. Useful when disabling
735+ -- certain features of an LSP (for example, turning off formatting for ts_ls)
736+ server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
737+ require (' lspconfig' )[server_name ].setup (server )
738+ end ,
739+ },
740+ }
741+ end
728742 end ,
729743 },
730744
0 commit comments