diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 335da15e..48c96059 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -230,20 +230,24 @@ return { if vim.lsp.is_enabled("denols") and vim.lsp.is_enabled("vtsls") then ---@param server string - ---@param markers string[] - local resolve = function(server, markers) + local resolve = function(server) + local markers, root_dir = vim.lsp.config[server].root_markers, vim.lsp.config[server].root_dir vim.lsp.config(server, { root_dir = function(bufnr, on_dir) local is_deno = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" }) ~= nil if is_deno == (server == "denols") then - local root = vim.fs.root(bufnr, markers) - return root and on_dir(root) + if root_dir then + return root_dir(bufnr, on_dir) + elseif type(markers) == "table" then + local root = vim.fs.root(bufnr, markers) + return root and on_dir(root) + end end end, }) end - resolve("denols", vim.lsp.config.denols.root_markers) - resolve("vtsls", vim.lsp.config.vtsls.root_markers) + resolve("denols") + resolve("vtsls") end end, },