File tree Expand file tree Collapse file tree 3 files changed +16
-13
lines changed Expand file tree Collapse file tree 3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ local utils = require "nvim-tree.utils"
2
2
local events = require " nvim-tree.events"
3
3
local lib = require " nvim-tree.lib"
4
4
local core = require " nvim-tree.core"
5
- local watch = require " nvim-tree.explorer.watch"
6
5
local notify = require " nvim-tree.notify"
7
6
8
7
local M = {}
@@ -99,22 +98,15 @@ function M.fn(node)
99
98
is_error = true
100
99
break
101
100
end
101
+ events ._dispatch_folder_created (path_to_create )
102
102
end
103
103
end
104
104
if not is_error then
105
105
notify .info (new_file_path .. " was properly created" )
106
106
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 )
118
110
end )
119
111
end
120
112
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ local view = require "nvim-tree.view"
3
3
local renderer = require " nvim-tree.renderer"
4
4
local explorer_module = require " nvim-tree.explorer"
5
5
local core = require " nvim-tree.core"
6
+ local log = require " nvim-tree.log"
6
7
7
8
local M = {}
8
9
@@ -39,11 +40,16 @@ function M.reload_explorer()
39
40
end
40
41
event_running = true
41
42
43
+ local ps = log .profile_start " reload_explorer"
44
+
42
45
local projects = git .reload ()
43
46
refresh_nodes (core .get_explorer (), projects )
44
47
if view .is_visible () then
45
48
renderer .draw ()
46
49
end
50
+
51
+ log .profile_end (ps , " reload_explorer" )
52
+
47
53
event_running = false
48
54
end
49
55
@@ -53,9 +59,14 @@ function M.reload_git()
53
59
end
54
60
event_running = true
55
61
62
+ local ps = log .profile_start " reload_git"
63
+
56
64
local projects = git .reload ()
57
65
M .reload_node_status (core .get_explorer (), projects )
58
66
renderer .draw ()
67
+
68
+ log .profile_end (ps , " reload_git" )
69
+
59
70
event_running = false
60
71
end
61
72
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ function Event:destroy(message)
88
88
89
89
if self ._fs_event then
90
90
if message then
91
- utils . notify .warn (message )
91
+ notify .warn (message )
92
92
end
93
93
94
94
local rc , _ , name = self ._fs_event :stop ()
You can’t perform that action at this time.
0 commit comments