Skip to content

Commit 60ded54

Browse files
committed
add suggestions
1 parent ff1296b commit 60ded54

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

lua/nvim-tree/explorer/init.lua

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,17 @@ function Explorer:refresh_parent_nodes_for_path(path)
241241
-- collect parent nodes from the top down
242242
local parent_nodes = {}
243243
NodeIterator.builder({ self })
244-
:recursor(function(node)
245-
return node.nodes
246-
end)
247-
:applier(function(node)
248-
local abs_contains = node.absolute_path and path:find(node.absolute_path, 1, true) == 1
249-
local link_contains = node.link_to and path:find(node.link_to, 1, true) == 1
250-
if abs_contains or link_contains then
251-
table.insert(parent_nodes, node)
252-
end
253-
end)
254-
:iterate()
244+
:recursor(function(node)
245+
return node.nodes
246+
end)
247+
:applier(function(node)
248+
local abs_contains = node.absolute_path and path:find(node.absolute_path, 1, true) == 1
249+
local link_contains = node.link_to and path:find(node.link_to, 1, true) == 1
250+
if abs_contains or link_contains then
251+
table.insert(parent_nodes, node)
252+
end
253+
end)
254+
:iterate()
255255

256256
-- refresh in order; this will expand groups as needed
257257
for _, node in ipairs(parent_nodes) do
@@ -369,13 +369,13 @@ function Explorer:populate_children(handle, cwd, node, git_status, parent)
369369
local filter_reason = parent.filters:should_filter_as_reason(abs, stat, filter_status)
370370
if filter_reason == FILTER_REASON.none and not nodes_by_path[abs] then
371371
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
372-
local type = stat and stat.type or nil
372+
local t = stat and stat.type or nil
373373
local child = nil
374-
if type == "directory" and vim.loop.fs_access(abs, "R") then
374+
if t == "directory" and vim.loop.fs_access(abs, "R") then
375375
child = builders.folder(node, abs, name, stat)
376-
elseif type == "file" then
376+
elseif t == "file" then
377377
child = builders.file(node, abs, name, stat)
378-
elseif type == "link" then
378+
elseif t == "link" then
379379
local link = builders.link(node, abs, name, stat)
380380
if link.link_to ~= nil then
381381
child = link
@@ -439,16 +439,16 @@ end
439439
---@param projects table
440440
function Explorer:refresh_nodes(projects)
441441
Iterator.builder({ self })
442-
:applier(function(n)
443-
if n.nodes then
444-
local toplevel = git.get_toplevel(n.cwd or n.link_to or n.absolute_path)
445-
self:reload(n, projects[toplevel] or {})
446-
end
447-
end)
448-
:recursor(function(n)
449-
return n.group_next and { n.group_next } or (n.open and n.nodes)
450-
end)
451-
:iterate()
442+
:applier(function(n)
443+
if n.nodes then
444+
local toplevel = git.get_toplevel(n.cwd or n.link_to or n.absolute_path)
445+
self:reload(n, projects[toplevel] or {})
446+
end
447+
end)
448+
:recursor(function(n)
449+
return n.group_next and { n.group_next } or (n.open and n.nodes)
450+
end)
451+
:iterate()
452452
end
453453

454454
local event_running = false

0 commit comments

Comments
 (0)