refacto: simplify interface of reload and explore

also make common group empty check in explorer utils
This commit is contained in:
kiyan
2022-02-20 15:08:36 +01:00
parent 41f51508e3
commit 527d88d54e
6 changed files with 32 additions and 25 deletions

View File

@@ -41,7 +41,7 @@ function M.fn(fname)
if #node.nodes == 0 then
local git_finished = false
git.load_project_status(node.absolute_path, function(status)
explorer_module.explore(node, node.absolute_path, status)
explorer_module.explore(node, status)
git_finished = true
end)
while not vim.wait(10, function() return git_finished end, 10) do end

View File

@@ -7,9 +7,9 @@ local explorer_module = require'nvim-tree.explorer'
local M = {}
local function refresh_nodes(node, projects)
local cwd = node.absolute_path or node.cwd
local cwd = node.cwd or node.link_to or node.absolute_path
local project_root = git.get_project_root(cwd)
explorer_module.reload(node, cwd, projects[project_root] or {})
explorer_module.reload(node, projects[project_root] or {})
for _, _node in ipairs(node.nodes) do
if _node.nodes and _node.open then
refresh_nodes(_node, projects)