mirror of https://github.com/folke/neoconf.nvim
feat(util): util.pick_root_dir
This commit is contained in:
parent
9f7b02fb0c
commit
197c17af57
|
|
@ -61,8 +61,7 @@ function M.on_config(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
if a and b then
|
if a and b then
|
||||||
-- return longest
|
return M.pick_root_dir(a, b)
|
||||||
return #a > #b and a or b
|
|
||||||
end
|
end
|
||||||
return a or b
|
return a or b
|
||||||
end
|
end
|
||||||
|
|
@ -70,6 +69,11 @@ function M.on_config(opts)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.pick_root_dir(a, b)
|
||||||
|
-- prefer the longest path
|
||||||
|
return #a > #b and a or b
|
||||||
|
end
|
||||||
|
|
||||||
---@param t table
|
---@param t table
|
||||||
---@param ret? table
|
---@param ret? table
|
||||||
function M.flatten(t, ret)
|
function M.flatten(t, ret)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue