feat(explorer): add filesystem watchers (#1304)
* feat(explorer): add experimental watchers This commit introduces watchers to update the tree. This behavior is introduced behind an "filesystem_watchers" option which should prevent instabilities. It will become the default at some point. Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -71,20 +71,25 @@ function M.fn(node)
|
||||
if node.nodes ~= nil and not node.link_to then
|
||||
trash_path(function()
|
||||
events._dispatch_folder_removed(node.absolute_path)
|
||||
require("nvim-tree.actions.reloaders").reload_explorer()
|
||||
if M.enable_reload then
|
||||
require("nvim-tree.actions.reloaders").reload_explorer()
|
||||
end
|
||||
end)
|
||||
else
|
||||
trash_path(function()
|
||||
events._dispatch_file_removed(node.absolute_path)
|
||||
clear_buffer(node.absolute_path)
|
||||
require("nvim-tree.actions.reloaders").reload_explorer()
|
||||
if M.enable_reload then
|
||||
require("nvim-tree.actions.reloaders").reload_explorer()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
M.config.trash = opts or {}
|
||||
M.config.trash = opts.trash or {}
|
||||
M.enable_reload = not opts.filesystem_watchers.enable
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user