@@ -212,7 +212,7 @@ local function cancel_inflight_requests(ctx)
212212 end )
213213end
214214
215- local function clear_preview ()
215+ function M . clear_preview ()
216216 logger .trace (" suggestion clear preview" )
217217 vim .api .nvim_buf_del_extmark (0 , copilot .ns_id , copilot .extmark_id )
218218end
@@ -251,14 +251,14 @@ local function get_current_suggestion(ctx)
251251end
252252
253253--- @param ctx ? copilot_suggestion_context
254- local function update_preview (ctx )
254+ function M . update_preview (ctx )
255255 ctx = ctx or get_ctx ()
256256 logger .trace (" suggestion update preview" , ctx )
257257
258258 local suggestion = get_current_suggestion (ctx )
259259 local displayLines = suggestion and vim .split (suggestion .displayText , " \n " , { plain = true }) or {}
260260
261- clear_preview ()
261+ M . clear_preview ()
262262
263263 if not suggestion or # displayLines == 0 then
264264 return
@@ -336,7 +336,7 @@ local function clear(ctx)
336336 ctx = ctx or get_ctx ()
337337 stop_timer ()
338338 cancel_inflight_requests (ctx )
339- update_preview (ctx )
339+ M . update_preview (ctx )
340340 reset_ctx (ctx )
341341end
342342
@@ -367,7 +367,7 @@ local function handle_trigger_request(err, data)
367367 ctx .suggestions = data and data .completions or {}
368368 ctx .choice = 1
369369 ctx .shown_choices = {}
370- update_preview ()
370+ M . update_preview ()
371371end
372372
373373local function trigger (bufnr , timer )
@@ -438,7 +438,7 @@ local function get_suggestions_cycling(callback, ctx)
438438 get_suggestions_cycling_callback (ctx , err , data )
439439 end )
440440 ctx .cycling = id --[[ @as integer]]
441- update_preview (ctx )
441+ M . update_preview (ctx )
442442 end )
443443 end
444444end
@@ -464,7 +464,7 @@ local function schedule(bufnr)
464464 stop_timer ()
465465 end
466466
467- update_preview ()
467+ M . update_preview ()
468468 bufnr = bufnr or vim .api .nvim_get_current_buf ()
469469 copilot ._copilot_timer = vim .fn .timer_start (copilot .debounce , function (timer )
470470 logger .trace (" suggestion schedule timer" , bufnr )
@@ -509,7 +509,7 @@ local function advance(count, ctx)
509509 ctx .choice = # ctx .suggestions
510510 end
511511
512- update_preview (ctx )
512+ M . update_preview (ctx )
513513end
514514
515515--- @param ctx copilot_suggestion_context
@@ -603,7 +603,7 @@ function M.accept(modifier)
603603 ctx .accepted_partial = true
604604 ignore_next_cursor_moved = true
605605 else
606- clear_preview ()
606+ M . clear_preview ()
607607 newText = suggestion .text
608608 end
609609
@@ -656,7 +656,7 @@ function M.accept(modifier)
656656 end
657657
658658 update_ctx_suggestion_position (ctx .choice , new_cursor_line - 1 , last_col , bufnr )
659- update_preview (ctx )
659+ M . update_preview (ctx )
660660 end
661661 end )()
662662end
@@ -702,7 +702,7 @@ function M.dismiss()
702702 local ctx = get_ctx ()
703703 reject ()
704704 clear (ctx )
705- update_preview (ctx )
705+ M . update_preview (ctx )
706706end
707707
708708function M .is_visible ()
0 commit comments