fix: properly reload nodes
This commit is contained in:
@@ -37,8 +37,9 @@ 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 not nodes_by_path[abs] then
|
||||||
if t == 'directory' and uv.fs_access(abs, 'R') then
|
if t == 'directory' and uv.fs_access(abs, 'R') then
|
||||||
table.insert(node.nodes, builders.folder(abs, name, status, node_ignored))
|
table.insert(node.nodes, builders.folder(abs, name, status, node_ignored))
|
||||||
elseif t == 'file' then
|
elseif t == 'file' then
|
||||||
@@ -51,13 +52,12 @@ function M.reload(node, cwd, status)
|
|||||||
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