mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
perf(explorer): early exit for tree calculation
This commit is contained in:
parent
c72e62ef90
commit
1a30610ab7
1 changed files with 4 additions and 2 deletions
|
@ -295,7 +295,7 @@ function M.search(opts, ctx)
|
|||
item.hidden = true
|
||||
end
|
||||
item.text = item.text:sub(1, #opts.cwd) == opts.cwd and item.text:sub(#opts.cwd + 2) or item.text
|
||||
local node = Tree:find(item.file)
|
||||
local node = Tree:node(item.file)
|
||||
if node then
|
||||
item.status = (not node.dir or opts.git_status_open) and node.status or nil
|
||||
end
|
||||
|
@ -334,7 +334,9 @@ function M.search(opts, ctx)
|
|||
|
||||
-- Add parents when needed
|
||||
for dir in Snacks.picker.util.parents(item.file, opts.cwd) do
|
||||
if not dirs[dir] then
|
||||
if dirs[dir] then
|
||||
break
|
||||
else
|
||||
dirs[dir] = {
|
||||
text = dir,
|
||||
file = dir,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue