chore: move nvim-tree.utils.warn -> notify.warn

add notify.error and notify.info
This commit is contained in:
kiyan
2022-07-18 13:46:11 +02:00
parent ec530e73be
commit 21fadc1f38
12 changed files with 40 additions and 29 deletions

View File

@@ -65,7 +65,7 @@ function M.fn(node)
utils.clear_prompt()
if utils.file_exists(new_file_path) then
utils.warn "Cannot create: file already exists"
utils.notify.warn "Cannot create: file already exists"
return
end

View File

@@ -13,13 +13,13 @@ end
function M.rename(node, to)
if utils.file_exists(to) then
utils.warn(err_fmt(node.absolute_path, to, "file already exists"))
utils.notify.warn(err_fmt(node.absolute_path, to, "file already exists"))
return
end
local success, err = uv.fs_rename(node.absolute_path, to)
if not success then
return utils.warn(err_fmt(node.absolute_path, to, err))
return utils.notify.warn(err_fmt(node.absolute_path, to, err))
end
utils.clear_prompt()
a.nvim_out_write(node.absolute_path .. "" .. to .. "\n")

View File

@@ -41,13 +41,13 @@ function M.fn(node)
M.config.trash.require_confirm = true
end
else
utils.warn "Trash is currently a UNIX only feature!"
utils.notify.warn "Trash is currently a UNIX only feature!"
return
end
local binary = M.config.trash.cmd:gsub(" .*$", "")
if vim.fn.executable(binary) == 0 then
utils.warn(binary .. " is not executable.")
utils.notify.warn(binary .. " is not executable.")
return
end
@@ -83,7 +83,7 @@ function M.fn(node)
if node.nodes ~= nil and not node.link_to then
trash_path(function(_, rc)
if rc ~= 0 then
utils.warn("trash failed: " .. err_msg .. "; please see :help nvim-tree.trash")
utils.notify.warn("trash failed: " .. err_msg .. "; please see :help nvim-tree.trash")
return
end
events._dispatch_folder_removed(node.absolute_path)
@@ -94,7 +94,7 @@ function M.fn(node)
else
trash_path(function(_, rc)
if rc ~= 0 then
utils.warn("trash failed: " .. err_msg .. "; please see :help nvim-tree.trash")
utils.notify.warn("trash failed: " .. err_msg .. "; please see :help nvim-tree.trash")
return
end
events._dispatch_file_removed(node.absolute_path)

View File

@@ -305,7 +305,7 @@ local function merge_mappings(user_mappings)
if not is_empty(map.action) then
M.custom_keypress_funcs[map.action] = map.action_cb
else
util.warn "action can't be empty if action_cb provided"
util.notify.warn "action can't be empty if action_cb provided"
end
end
end

View File

@@ -10,7 +10,7 @@ local M = {
function M.fn(node)
if #M.config.system_open.cmd == 0 then
require("nvim-tree.utils").warn "Cannot open file with system application. Unrecognized platform."
require("nvim-tree.utils").notify.warn "Cannot open file with system application. Unrecognized platform."
return
end

View File

@@ -58,7 +58,7 @@ end
function M.fn(base_node)
local node = base_node.nodes and base_node or core.get_explorer()
if gen_iterator()(node) then
utils.warn("expansion iteration was halted after " .. M.MAX_FOLDER_DISCOVERY .. " discovered folders")
utils.notify.warn("expansion iteration was halted after " .. M.MAX_FOLDER_DISCOVERY .. " discovered folders")
end
renderer.draw()
end