This commit is contained in:
committed by
GitHub
parent
66c15afd13
commit
9c97e6449b
@@ -30,8 +30,10 @@ function M.fn(fname)
|
|||||||
|
|
||||||
local profile = log.profile_start("find file %s", fname_real)
|
local profile = log.profile_start("find file %s", fname_real)
|
||||||
|
|
||||||
-- we cannot wait for watchers
|
-- we cannot wait for watchers to populate a new node
|
||||||
reload.refresh_nodes_for_path(vim.fn.fnamemodify(fname_real, ":h"))
|
if utils.get_node_from_path(fname_real) == nil then
|
||||||
|
reload.refresh_nodes_for_path(vim.fn.fnamemodify(fname_real, ":h"))
|
||||||
|
end
|
||||||
|
|
||||||
local line = core.get_nodes_starting_line()
|
local line = core.get_nodes_starting_line()
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ function M.refresh_nodes_for_path(path)
|
|||||||
|
|
||||||
local profile = log.profile_start("refresh_nodes_for_path %s", path)
|
local profile = log.profile_start("refresh_nodes_for_path %s", path)
|
||||||
|
|
||||||
|
-- avoids cycles
|
||||||
|
local absolute_paths_refreshed = {}
|
||||||
|
|
||||||
NodeIterator.builder({ explorer })
|
NodeIterator.builder({ explorer })
|
||||||
:hidden()
|
:hidden()
|
||||||
:recursor(function(node)
|
:recursor(function(node)
|
||||||
@@ -177,10 +180,13 @@ function M.refresh_nodes_for_path(path)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
:applier(function(node)
|
:applier(function(node)
|
||||||
local abs_contains = node.absolute_path and path:match("^" .. node.absolute_path)
|
local abs_contains = node.absolute_path and path:find(node.absolute_path, 1, true) == 1
|
||||||
local link_contains = node.link_to and path:match("^" .. node.link_to)
|
local link_contains = node.link_to and path:find(node.link_to, 1, true) == 1
|
||||||
if abs_contains or link_contains then
|
if abs_contains or link_contains then
|
||||||
M.refresh_node(node)
|
if not absolute_paths_refreshed[node.absolute_path] then
|
||||||
|
absolute_paths_refreshed[node.absolute_path] = true
|
||||||
|
M.refresh_node(node)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
:iterate()
|
:iterate()
|
||||||
|
|||||||
Reference in New Issue
Block a user