fix: properly reload nodes
This commit is contained in:
@@ -37,27 +37,27 @@ function M.reload(node, cwd, status)
|
|||||||
|
|
||||||
local abs = utils.path_join({cwd, name})
|
local abs = utils.path_join({cwd, name})
|
||||||
t = t or (uv.fs_stat(abs) or {}).type
|
t = t or (uv.fs_stat(abs) or {}).type
|
||||||
if not nodes_by_path[abs] and not eutils.should_ignore(abs) and not eutils.should_ignore_git(abs, status.files) then
|
if not eutils.should_ignore(abs) and not eutils.should_ignore_git(abs, status.files) then
|
||||||
child_names[abs] = true
|
child_names[abs] = true
|
||||||
if t == 'directory' and uv.fs_access(abs, 'R') then
|
if not nodes_by_path[abs] then
|
||||||
table.insert(node.nodes, builders.folder(abs, name, status, node_ignored))
|
if t == 'directory' and uv.fs_access(abs, 'R') then
|
||||||
elseif t == 'file' then
|
table.insert(node.nodes, builders.folder(abs, name, status, node_ignored))
|
||||||
table.insert(node.nodes, builders.file(abs, name, status, node_ignored))
|
elseif t == 'file' then
|
||||||
elseif t == 'link' then
|
table.insert(node.nodes, builders.file(abs, name, status, node_ignored))
|
||||||
local link = builders.link(abs, name, status, node_ignored)
|
elseif t == 'link' then
|
||||||
if link.link_to ~= nil then
|
local link = builders.link(abs, name, status, node_ignored)
|
||||||
table.insert(node.nodes, link)
|
if link.link_to ~= nil then
|
||||||
|
table.insert(node.nodes, link)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
dump(child_names)
|
node.nodes = vim.tbl_filter(
|
||||||
for i, n in ipairs(node.nodes) do
|
function(n) return child_names[n.absolute_path] end,
|
||||||
if not child_names[n.absolute_path] then
|
node.nodes
|
||||||
table.remove(node.nodes, i)
|
)
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.g.nvim_tree_group_empty == 1 then
|
if vim.g.nvim_tree_group_empty == 1 then
|
||||||
local child_node = node.nodes[1]
|
local child_node = node.nodes[1]
|
||||||
|
|||||||
Reference in New Issue
Block a user