@@ -3,13 +3,11 @@ local M = {}
33M .setup = function ()
44 local diagnostics_virtual_lines = require (" core.settings" ).diagnostics_virtual_lines
55 local diagnostics_level = require (" core.settings" ).diagnostics_level
6+ local lsp_deps = require (" core.settings" ).lsp_deps
67
7- local nvim_lsp = require (" lspconfig" )
8- local mason_lspconfig = require (" mason-lspconfig" )
98 require (" lspconfig.ui.windows" ).default_options .border = " rounded"
10-
119 require (" modules.utils" ).load_plugin (" mason-lspconfig" , {
12- ensure_installed = require ( " core.settings " ). lsp_deps ,
10+ ensure_installed = lsp_deps ,
1311 })
1412
1513 vim .diagnostic .config ({
@@ -61,22 +59,25 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
6159
6260 if not ok then
6361 -- Default to use factory config for server(s) that doesn't include a spec
64- nvim_lsp [ lsp_name ]. setup ( opts )
65- return
62+ vim . lsp . config ( lsp_name , opts )
63+ vim . lsp . enable ( lsp_name )
6664 elseif type (custom_handler ) == " function" then
6765 --- Case where language server requires its own setup
6866 --- Make sure to call require("lspconfig")[lsp_name].setup() in the function
6967 --- See `clangd.lua` for example.
7068 custom_handler (opts )
69+ vim .lsp .enable (lsp_name )
7170 elseif type (custom_handler ) == " table" then
72- nvim_lsp [lsp_name ].setup (
71+ vim .lsp .config (
72+ lsp_name ,
7373 vim .tbl_deep_extend (
7474 " force" ,
7575 opts ,
7676 type (default_handler ) == " table" and default_handler or {},
7777 custom_handler
7878 )
7979 )
80+ vim .lsp .enable (lsp_name )
8081 else
8182 vim .notify (
8283 string.format (
@@ -88,9 +89,12 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
8889 { title = " nvim-lspconfig" }
8990 )
9091 end
92+ return
9193 end
9294
93- mason_lspconfig .setup_handlers ({ mason_lsp_handler })
95+ for _ , lsp in ipairs (lsp_deps ) do
96+ mason_lsp_handler (lsp )
97+ end
9498end
9599
96100return M
0 commit comments