diff --git a/lua/modules/configs/completion/mason-lspconfig.lua b/lua/modules/configs/completion/mason-lspconfig.lua index 567ff9f94..4e8bb74d5 100644 --- a/lua/modules/configs/completion/mason-lspconfig.lua +++ b/lua/modules/configs/completion/mason-lspconfig.lua @@ -52,14 +52,19 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire end local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name) + local predefined_ok, predefined = pcall(require, "completion.servers." .. lsp_name) -- Use preset if there is no user definition if not ok then - ok, custom_handler = pcall(require, "completion.servers." .. lsp_name) + ok, custom_handler = predefined_ok, predefined + else + if type(custom_handler) == "table" and type(predefined) == "table" then + custom_handler = vim.tbl_deep_extend("force", predefined, custom_handler) + end end + if not ok then -- Default to use factory config for server(s) that doesn't include a spec nvim_lsp[lsp_name].setup(opts) - return elseif type(custom_handler) == "function" then --- Case where language server requires its own setup --- Make sure to call require("lspconfig")[lsp_name].setup() in the function