Skip to content

Commit d91f885

Browse files
committed
Revert "fix(#1723): find_file for externally created new file results in folder unable to be opened"
This reverts commit be2ccd4.
1 parent 8cc3696 commit d91f885

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lua/nvim-tree/actions/finders/find-file.lua

+7-8
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,20 @@ function M.fn(fname)
1515
if running[fname] or not core.get_explorer() then
1616
return
1717
end
18+
running[fname] = true
1819

20+
local ps = log.profile_start("find file %s", fname)
1921
-- always match against the real path
2022
local fname_real = vim.loop.fs_realpath(fname)
2123
if not fname_real then
2224
return
2325
end
2426

25-
running[fname] = true
26-
27-
local ps = log.profile_start("find file %s", fname)
28-
29-
-- first line is the root node
30-
local line = core.get_nodes_starting_line() - 1
27+
local line = core.get_nodes_starting_line()
3128

3229
local absolute_paths_searched = {}
3330

34-
local found = Iterator.builder({ core.get_explorer() })
31+
local found = Iterator.builder(core.get_explorer().nodes)
3532
:matcher(function(node)
3633
return node.absolute_path == fname_real or node.link_to == fname_real
3734
end)
@@ -48,7 +45,9 @@ function M.fn(fname)
4845

4946
if abs_match or link_match then
5047
node.open = true
51-
core.get_explorer():expand(node)
48+
if #node.nodes == 0 then
49+
core.get_explorer():expand(node)
50+
end
5251
end
5352
end)
5453
:recursor(function(node)

0 commit comments

Comments
 (0)