@@ -483,7 +483,7 @@ require('lazy').setup({
483
483
-- Mason must be loaded before its dependents so we need to set it up here.
484
484
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
485
485
{ ' mason-org/mason.nvim' , opts = {} },
486
- ' mason-org/mason-lspconfig.nvim' ,
486
+ { ' mason-org/mason-lspconfig.nvim' } ,
487
487
' WhoIsSethDaniel/mason-tool-installer.nvim' ,
488
488
489
489
-- Useful status updates for LSP.
@@ -700,6 +700,14 @@ require('lazy').setup({
700
700
},
701
701
}
702
702
703
+ -- The following loop will configure each server with the capabilities we defined above.
704
+ -- This will ensure that all servers have the same base configuration, but also
705
+ -- allow for server-specific overrides.
706
+ for server_name , server_config in pairs (servers ) do
707
+ server_config .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server_config .capabilities or {})
708
+ require (' lspconfig' )[server_name ].setup (server_config )
709
+ end
710
+
703
711
-- Ensure the servers and tools above are installed
704
712
--
705
713
-- To check the current status of installed tools and/or manually install
@@ -718,21 +726,6 @@ require('lazy').setup({
718
726
' stylua' , -- Used to format Lua code
719
727
})
720
728
require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
721
-
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
- }
736
729
end ,
737
730
},
738
731
0 commit comments