Skip to content

Commit 4074666

Browse files
committed
fix: don't search child if parent exist
avoid /after/** is included twice
1 parent 2834f98 commit 4074666

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lua/fzf-lua-extra/providers/runtime.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,25 @@ local test = function()
3838
})
3939
end
4040

41+
local dedup = function(paths)
42+
table.sort(paths, function(a, b) return #a < #b end)
43+
local res = {}
44+
for _, path in ipairs(paths) do
45+
if not vim.iter(res):any(function(p) return vim.fs.relpath(p, path) end) then
46+
res[#res + 1] = path
47+
end
48+
end
49+
return res
50+
end
51+
4152
---@return string[]
4253
local get_rtp = function()
4354
---@type string[]
4455
local rtp = vim.opt.runtimepath:get()
4556
-- If using lazy.nvim, get all the lazy loaded plugin paths (#1296)
4657
local lazy = package.loaded['lazy.core.util']
4758
if lazy and lazy.get_unloaded_rtp then vim.list_extend(rtp, (lazy.get_unloaded_rtp(''))) end
48-
return rtp
59+
return dedup(rtp)
4960
end
5061

5162
local _ = {}

0 commit comments

Comments
 (0)