feat(#2270): add notify.absolute_path - show file or absolute path (default) names with notifications (#2286)

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Asror
2023-06-24 23:06:21 -04:00
committed by GitHub
parent 7aff29d755
commit 3cc698b35b
7 changed files with 38 additions and 16 deletions

View File

@@ -74,22 +74,23 @@ end
--- Remove a node, notify errors, dispatch events
--- @param node table
function M.remove(node)
local notify_node = notify.render_path(node.absolute_path)
if node.nodes ~= nil and not node.link_to then
local success = remove_dir(node.absolute_path)
if not success then
return notify.error("Could not remove " .. node.name)
return notify.error("Could not remove " .. notify_node)
end
events._dispatch_folder_removed(node.absolute_path)
else
events._dispatch_will_remove_file(node.absolute_path)
local success = vim.loop.fs_unlink(node.absolute_path)
if not success then
return notify.error("Could not remove " .. node.name)
return notify.error("Could not remove " .. notify_node)
end
events._dispatch_file_removed(node.absolute_path)
clear_buffer(node.absolute_path)
end
notify.info(node.absolute_path .. " was properly removed.")
notify.info(notify_node .. " was properly removed.")
end
function M.fn(node)