feat: add user autocmds before and after performing actions (#310)
This commit is contained in:
parent
32e18df30f
commit
e462a34465
1 changed files with 10 additions and 2 deletions
|
|
@ -367,6 +367,10 @@ end
|
|||
---@param actions oil.Action[]
|
||||
---@param cb fun(err: nil|string)
|
||||
M.process_actions = function(actions, cb)
|
||||
vim.api.nvim_exec_autocmds(
|
||||
"User",
|
||||
{ pattern = "OilActionsPre", modeline = false, data = { actions = actions } }
|
||||
)
|
||||
local did_complete = lsp_helpers.will_perform_file_operations(actions)
|
||||
|
||||
-- Convert some cross-adapter moves to a copy + delete
|
||||
|
|
@ -387,11 +391,15 @@ M.process_actions = function(actions, cb)
|
|||
|
||||
local finished = false
|
||||
local progress = Progress.new()
|
||||
local function finish(...)
|
||||
local function finish(err)
|
||||
if not finished then
|
||||
finished = true
|
||||
progress:close()
|
||||
cb(...)
|
||||
vim.api.nvim_exec_autocmds(
|
||||
"User",
|
||||
{ pattern = "OilActionsPost", modeline = false, data = { err = err, actions = actions } }
|
||||
)
|
||||
cb(err)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue