mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-06 07:24:39 +02:00
fix(root): only use workspace folders that contain the buffer
This commit is contained in:
parent
5bb74205a0
commit
592f3b03bb
1 changed files with 6 additions and 2 deletions
|
@ -26,7 +26,8 @@ function M.detectors.cwd()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.detectors.lsp(buf)
|
function M.detectors.lsp(buf)
|
||||||
if not M.bufpath(buf) then
|
local bufpath = M.bufpath(buf)
|
||||||
|
if not bufpath then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
local roots = {} ---@type string[]
|
local roots = {} ---@type string[]
|
||||||
|
@ -39,7 +40,10 @@ function M.detectors.lsp(buf)
|
||||||
roots[#roots + 1] = client.config.root_dir
|
roots[#roots + 1] = client.config.root_dir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return roots
|
return vim.tbl_filter(function(path)
|
||||||
|
path = Util.norm(path)
|
||||||
|
return path and bufpath:find(path, 1, true) == 1
|
||||||
|
end, roots)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param patterns string[]|string
|
---@param patterns string[]|string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue