fix: wrap nvim_del_autocmd in vim.schedule to avoid fast event context error (#2873)

nvim_del_autocmd was being called in a callback from acp_client, which is a
fast event context where it's not allowed. Wrapping it with vim.schedule()
defers the execution to a safe context.

Signed-off-by: Nayab Sayed <nayabbasha.sayed@microchip.com>
This commit is contained in:
Nayab Sayed
2025-12-21 16:05:19 +05:30
committed by GitHub
parent cf352f6f46
commit b62b6370fc

View File

@@ -1595,7 +1595,7 @@ function M._continue_stream_acp(opts, acp_client, session_id)
})
acp_client:send_prompt(session_id, prompt, function(_, err_)
if cancelled then return end
api.nvim_del_autocmd(stop_cmd_id)
vim.schedule(function() api.nvim_del_autocmd(stop_cmd_id) end)
if err_ then
-- ACP-specific session recovery: Check for session not found error
-- Check for session recovery conditions