Skip to content

Commit de12e39

Browse files
committed
Merge remote-tracking branch 'upstream/master' into sync-close-through-tabs
2 parents a23b11d + 8cc3696 commit de12e39

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local utils = require "nvim-tree.utils"
22
local events = require "nvim-tree.events"
33
local lib = require "nvim-tree.lib"
44
local core = require "nvim-tree.core"
5-
local watch = require "nvim-tree.explorer.watch"
65
local notify = require "nvim-tree.notify"
76

87
local M = {}
@@ -99,22 +98,15 @@ function M.fn(node)
9998
is_error = true
10099
break
101100
end
101+
events._dispatch_folder_created(path_to_create)
102102
end
103103
end
104104
if not is_error then
105105
notify.info(new_file_path .. " was properly created")
106106
end
107-
events._dispatch_folder_created(new_file_path)
108-
if M.enable_reload then
109-
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
110-
else
111-
-- synchronous call required so that we may focus the file now
112-
node = node.nodes ~= nil and node or node.parent
113-
if node then
114-
watch.refresh_path(node.absolute_path)
115-
end
116-
end
117-
utils.focus_file(utils.path_remove_trailing(new_file_path))
107+
108+
-- implicitly refreshes contents
109+
require("nvim-tree.actions.finders.find-file").fn(new_file_path)
118110
end)
119111
end
120112

lua/nvim-tree/actions/reloaders/reloaders.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local view = require "nvim-tree.view"
33
local renderer = require "nvim-tree.renderer"
44
local explorer_module = require "nvim-tree.explorer"
55
local core = require "nvim-tree.core"
6+
local log = require "nvim-tree.log"
67

78
local M = {}
89

@@ -39,11 +40,16 @@ function M.reload_explorer()
3940
end
4041
event_running = true
4142

43+
local ps = log.profile_start "reload_explorer"
44+
4245
local projects = git.reload()
4346
refresh_nodes(core.get_explorer(), projects)
4447
if view.is_visible() then
4548
renderer.draw()
4649
end
50+
51+
log.profile_end(ps, "reload_explorer")
52+
4753
event_running = false
4854
end
4955

@@ -53,9 +59,14 @@ function M.reload_git()
5359
end
5460
event_running = true
5561

62+
local ps = log.profile_start "reload_git"
63+
5664
local projects = git.reload()
5765
M.reload_node_status(core.get_explorer(), projects)
5866
renderer.draw()
67+
68+
log.profile_end(ps, "reload_git")
69+
5970
event_running = false
6071
end
6172

lua/nvim-tree/watcher.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function Event:destroy(message)
8888

8989
if self._fs_event then
9090
if message then
91-
utils.notify.warn(message)
91+
notify.warn(message)
9292
end
9393

9494
local rc, _, name = self._fs_event:stop()

0 commit comments

Comments
 (0)