mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-03-10 09:27:25 +00:00
fix(lsp): properly ambiguate denols vs vtsls
This commit is contained in:
@@ -230,20 +230,24 @@ return {
|
|||||||
|
|
||||||
if vim.lsp.is_enabled("denols") and vim.lsp.is_enabled("vtsls") then
|
if vim.lsp.is_enabled("denols") and vim.lsp.is_enabled("vtsls") then
|
||||||
---@param server string
|
---@param server string
|
||||||
---@param markers string[]
|
local resolve = function(server)
|
||||||
local resolve = function(server, markers)
|
local markers, root_dir = vim.lsp.config[server].root_markers, vim.lsp.config[server].root_dir
|
||||||
vim.lsp.config(server, {
|
vim.lsp.config(server, {
|
||||||
root_dir = function(bufnr, on_dir)
|
root_dir = function(bufnr, on_dir)
|
||||||
local is_deno = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" }) ~= nil
|
local is_deno = vim.fs.root(bufnr, { "deno.json", "deno.jsonc" }) ~= nil
|
||||||
if is_deno == (server == "denols") then
|
if is_deno == (server == "denols") then
|
||||||
|
if root_dir then
|
||||||
|
return root_dir(bufnr, on_dir)
|
||||||
|
elseif type(markers) == "table" then
|
||||||
local root = vim.fs.root(bufnr, markers)
|
local root = vim.fs.root(bufnr, markers)
|
||||||
return root and on_dir(root)
|
return root and on_dir(root)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
resolve("denols", vim.lsp.config.denols.root_markers)
|
resolve("denols")
|
||||||
resolve("vtsls", vim.lsp.config.vtsls.root_markers)
|
resolve("vtsls")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user