@@ -681,6 +681,13 @@ require('lazy').setup({
681
681
},
682
682
},
683
683
}
684
+
685
+ --- @type MasonLspconfigSettings
686
+ --- @diagnostic disable-next-line : missing-fields
687
+ require (' mason-lspconfig' ).setup {
688
+ automatic_enable = vim .tbl_keys (servers or {}),
689
+ }
690
+
684
691
-- Ensure the servers and tools above are installed
685
692
--
686
693
-- To check the current status of installed tools and/or manually install
@@ -700,18 +707,11 @@ require('lazy').setup({
700
707
})
701
708
require (' mason-tool-installer' ).setup { ensure_installed = ensure_installed }
702
709
703
- require (' mason-lspconfig' ).setup {
704
- handlers = {
705
- function (server_name )
706
- local server = servers [server_name ] or {}
707
- -- This handles overriding only values explicitly passed
708
- -- by the server configuration above. Useful when disabling
709
- -- certain features of an LSP (for example, turning off formatting for ts_ls)
710
- server .capabilities = vim .tbl_deep_extend (' force' , {}, capabilities , server .capabilities or {})
711
- require (' lspconfig' )[server_name ].setup (server )
712
- end ,
713
- },
714
- }
710
+ -- Installed LSPs are configured and enabled automatically with mason-lspconfig
711
+ -- The loop below is for overriding the default configuration of LSPs with the ones in the servers table
712
+ for server_name , config in pairs (servers ) do
713
+ vim .lsp .config (server_name , config )
714
+ end
715
715
end ,
716
716
},
717
717
{ -- Autoformat
0 commit comments