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

This reverts commit be2ccd4b1a.
This commit is contained in:
Alexander Courtis
2022-11-06 13:21:24 +11:00
parent 8cc369695b
commit d91f885819

View File

@@ -15,23 +15,20 @@ function M.fn(fname)
if running[fname] or not core.get_explorer() then if running[fname] or not core.get_explorer() then
return return
end end
running[fname] = true
local ps = log.profile_start("find file %s", fname)
-- always match against the real path -- always match against the real path
local fname_real = vim.loop.fs_realpath(fname) local fname_real = vim.loop.fs_realpath(fname)
if not fname_real then if not fname_real then
return return
end end
running[fname] = true local line = core.get_nodes_starting_line()
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 absolute_paths_searched = {}
local found = Iterator.builder({ core.get_explorer() }) local found = Iterator.builder(core.get_explorer().nodes)
:matcher(function(node) :matcher(function(node)
return node.absolute_path == fname_real or node.link_to == fname_real return node.absolute_path == fname_real or node.link_to == fname_real
end) end)
@@ -48,7 +45,9 @@ function M.fn(fname)
if abs_match or link_match then if abs_match or link_match then
node.open = true node.open = true
core.get_explorer():expand(node) if #node.nodes == 0 then
core.get_explorer():expand(node)
end
end end
end) end)
:recursor(function(node) :recursor(function(node)