Skip to content

Commit 826e468

Browse files
committed
perf: cancel operations prior to requesting a new one
1 parent e599a76 commit 826e468

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/copilot/suggestion.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ local function schedule(ctx)
428428
end
429429
logger.trace("suggestion schedule", ctx)
430430

431+
if copilot._copilot_timer then
432+
cancel_inflight_requests(ctx)
433+
stop_timer()
434+
end
435+
431436
update_preview(ctx)
432437
local bufnr = vim.api.nvim_get_current_buf()
433438
copilot._copilot_timer = vim.fn.timer_start(copilot.debounce, function(timer)

0 commit comments

Comments
 (0)