Skip to content

Commit 014b33f

Browse files
committed
fix(util.root_path): search all patterns per dir
util.root_path used to search each pattern on all parent directories, with this change it will look for all patterns on each parent dir, thus finding closest matchers first.
1 parent a9bc587 commit 014b33f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lua/lspconfig/util.lua

+6-6
Original file line numberDiff line numberDiff line change
@@ -276,18 +276,18 @@ function M.root_pattern(...)
276276
local patterns = M.tbl_flatten { ... }
277277
return function(startpath)
278278
startpath = M.strip_archive_subpath(startpath)
279-
for _, pattern in ipairs(patterns) do
280-
local match = M.search_ancestors(startpath, function(path)
279+
local match = M.search_ancestors(startpath, function(path)
280+
for _, pattern in ipairs(patterns) do
281281
for _, p in ipairs(vim.fn.glob(M.path.join(M.path.escape_wildcards(path), pattern), true, true)) do
282282
if M.path.exists(p) then
283283
return path
284284
end
285285
end
286-
end)
287-
288-
if match ~= nil then
289-
return match
290286
end
287+
end)
288+
289+
if match ~= nil then
290+
return match
291291
end
292292
end
293293
end

0 commit comments

Comments
 (0)