updates
This commit is contained in:
@@ -48,7 +48,7 @@ function M:pop_progress_handle(id)
|
||||
end
|
||||
|
||||
function M:create_progress_handle(request)
|
||||
local title = " Requesting assistance"
|
||||
local title = " Requesting assistance"
|
||||
.. " ("
|
||||
.. request.data.strategy
|
||||
.. ") from "
|
||||
@@ -56,7 +56,9 @@ function M:create_progress_handle(request)
|
||||
.. " using "
|
||||
.. request.data.adapter.model
|
||||
local idx = 1
|
||||
local notification_id = notify(spinner_frames[idx] .. " In progress...", "info", { title = title, timeout = false })
|
||||
local start_time = os.time()
|
||||
local notification_id =
|
||||
notify(spinner_frames[idx] .. " In progress (" .. "0s" .. ")...", "info", { title = title, timeout = false })
|
||||
local handle = { notification_id = notification_id, title = title, finished = false }
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(
|
||||
@@ -67,13 +69,17 @@ function M:create_progress_handle(request)
|
||||
return
|
||||
end -- stop updating if finished
|
||||
idx = idx % spinner_len + 1
|
||||
local elapsed = os.difftime(os.time(), start_time)
|
||||
local opts = { replace = handle.notification_id, title = title, timeout = false }
|
||||
local ok, new_id = safe_notify(spinner_frames[idx] .. " In progress...", "info", opts)
|
||||
local ok, new_id = safe_notify(spinner_frames[idx] .. " In progress (" .. elapsed .. "s)...", "info", opts)
|
||||
if ok then
|
||||
handle.notification_id = new_id
|
||||
else
|
||||
handle.notification_id =
|
||||
notify(spinner_frames[idx] .. " In progress...", "info", { title = title, timeout = false })
|
||||
handle.notification_id = notify(
|
||||
spinner_frames[idx] .. " In progress (" .. elapsed .. "s)...",
|
||||
"info",
|
||||
{ title = title, timeout = false }
|
||||
)
|
||||
end
|
||||
end)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user