From d80da229b46078ac0d0d6a4e31e28618c4faa97f Mon Sep 17 00:00:00 2001 From: Bruno Henrique de Castro Date: Sun, 11 Dec 2022 14:42:41 -0300 Subject: [PATCH] fix: avoid mutating global lsp opts when using custom server opts --- lua/config/lsp/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/config/lsp/init.lua b/lua/config/lsp/init.lua index dcab11d..d990e7e 100644 --- a/lua/config/lsp/init.lua +++ b/lua/config/lsp/init.lua @@ -52,11 +52,13 @@ import({ "mason", "mason-lspconfig", "lspconfig", "cmp_nvim_lsp" }, function(mod function(server_name) local has_custom_opts, custom_opts = pcall(require, "config.lsp.settings." .. server_name) + local server_opts = opts + if has_custom_opts then - opts = vim.tbl_deep_extend("force", custom_opts, opts) + server_opts = vim.tbl_deep_extend("force", custom_opts, opts) end - modules.lspconfig[server_name].setup(opts) + modules.lspconfig[server_name].setup(server_opts) end, ["tsserver"] = function() import("typescript", function(typescript)