feat(notify): add notify.threshold (#1693)

* feat: configurable notification level

add `notify.threshold` to setup opts

* feat: configurable notification level: add threshold example doc

* feat: configurable notification level: log always comes last

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
kylo252
2022-11-01 00:24:40 +01:00
committed by GitHub
parent ada2c6441d
commit 6ca6f99e76
19 changed files with 120 additions and 66 deletions

View File

@@ -5,6 +5,7 @@ local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local view = require "nvim-tree.view"
local lib = require "nvim-tree.lib"
local notify = require "nvim-tree.notify"
local M = {}
@@ -44,7 +45,7 @@ end
local function remove_dir(cwd)
local handle = luv.fs_scandir(cwd)
if type(handle) == "string" then
return utils.notify.error(handle)
return notify.error(handle)
end
while true do
@@ -83,18 +84,18 @@ function M.fn(node)
if node.nodes ~= nil and not node.link_to then
local success = remove_dir(node.absolute_path)
if not success then
return utils.notify.error("Could not remove " .. node.name)
return notify.error("Could not remove " .. node.name)
end
events._dispatch_folder_removed(node.absolute_path)
else
local success = luv.fs_unlink(node.absolute_path)
if not success then
return utils.notify.error("Could not remove " .. node.name)
return notify.error("Could not remove " .. node.name)
end
events._dispatch_file_removed(node.absolute_path)
clear_buffer(node.absolute_path)
end
utils.notify.info(node.absolute_path .. " was properly removed.")
notify.info(node.absolute_path .. " was properly removed.")
if M.enable_reload then
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
end