Skip to content

Commit 06f3429

Browse files
committed
fix: schedule before find file
1 parent 6e7f5ea commit 06f3429

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/nvim-tree/actions/fs/create-file.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ local function create_file(new_file_path)
9797
if not is_error then
9898
notify.info(new_file_path .. " was properly created")
9999
end
100+
if M.enable_async then
101+
async.schedule()
102+
end
103+
-- synchronously refreshes as we can't wait for the watchers
104+
find_file(utils.path_remove_trailing(new_file_path))
100105
end
101106

102107
local function get_containing_folder(node)
@@ -135,15 +140,12 @@ function M.fn(node, cb)
135140

136141
if M.enable_async then
137142
async.exec(create_file, new_file_path, function(err)
138-
find_file(utils.path_remove_trailing(new_file_path))
139143
if cb then
140144
cb(err)
141145
end
142146
end)
143147
else
144148
create_file(new_file_path)
145-
-- synchronously refreshes as we can't wait for the watchers
146-
find_file(utils.path_remove_trailing(new_file_path))
147149
end
148150
end)
149151
end

0 commit comments

Comments
 (0)