fix fidget spinner notification not closing

This commit is contained in:
sudacode 2025-02-16 19:15:26 -08:00
parent 19567ee2b5
commit 51cf93a90e
Signed by: sudacode
SSH Key Fingerprint: SHA256:lT5C2bB398DcX6daCF/gYFNSTK3y+Du3oTGUnYzfTEw

View File

@ -1,6 +1,7 @@
local notify = require("notify") local notify = require("notify")
local spinner_frames = { "", "", "", "", "", "", "", "", "", "" } local spinner_frames = { "", "", "", "", "", "", "", "", "", "" }
local M = {} local M = {}
local timeout = 3000
function M:init() function M:init()
local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {}) local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {})
@ -75,11 +76,11 @@ end
function M:report_exit_status(handle, request) function M:report_exit_status(handle, request)
local title = handle.title or (" Requesting assistance (" .. request.data.strategy .. ")") local title = handle.title or (" Requesting assistance (" .. request.data.strategy .. ")")
if request.data.status == "success" then if request.data.status == "success" then
notify("Completed", "info", { replace = handle.notification_id, title = title }) notify("Completed", "info", { replace = handle.notification_id, title = title, timeout = timeout })
elseif request.data.status == "error" then elseif request.data.status == "error" then
notify(" Error", "error", { replace = handle.notification_id, title = title }) notify(" Error", "error", { replace = handle.notification_id, title = title, timeout = timeout })
else else
notify("󰜺 Cancelled", "warn", { replace = handle.notification_id, title = title }) notify("󰜺 Cancelled", "warn", { replace = handle.notification_id, title = title, timeout = timeout })
end end
end end