fix(#1723): find_file for externally created new file results in folder unable to be opened

* fix(#1723): find_file for externally created new file results in folder unable to be opened

* fix(#1723): find_file for externally created new file results in folder unable to be opened
This commit is contained in:
Alexander Courtis 2022-11-05 16:34:41 +11:00 committed by GitHub
parent a0f3e99b2d
commit be2ccd4b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,20 +16,23 @@ function M.fn(fname)
if running[fname] or not core.get_explorer() then
return
end
running[fname] = true
local ps = log.profile_start("find file %s", fname)
-- always match against the real path
local fname_real = uv.fs_realpath(fname)
if not fname_real then
return
end
local line = core.get_nodes_starting_line()
running[fname] = true
local ps = log.profile_start("find file %s", fname)
-- first line is the root node
local line = core.get_nodes_starting_line() - 1
local absolute_paths_searched = {}
local found = Iterator.builder(core.get_explorer().nodes)
local found = Iterator.builder({ core.get_explorer() })
:matcher(function(node)
return node.absolute_path == fname_real or node.link_to == fname_real
end)
@ -46,9 +49,7 @@ function M.fn(fname)
if abs_match or link_match then
node.open = true
if #node.nodes == 0 then
core.get_explorer():expand(node)
end
core.get_explorer():expand(node)
end
end)
:recursor(function(node)