Skip to content

1723 unable to open directory with new file #1724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lua/nvim-tree/actions/finders/find-file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down