@@ -197,7 +197,7 @@ local function cancel_inflight_requests(ctx)
197197 end )
198198end
199199
200- local function clear_preview ()
200+ function M . clear_preview ()
201201 logger .trace (" suggestion clear preview" )
202202 vim .api .nvim_buf_del_extmark (0 , copilot .ns_id , copilot .extmark_id )
203203end
@@ -236,14 +236,14 @@ local function get_current_suggestion(ctx)
236236end
237237
238238--- @param ctx ? copilot_suggestion_context
239- local function update_preview (ctx )
239+ function M . update_preview (ctx )
240240 ctx = ctx or get_ctx ()
241241 logger .trace (" suggestion update preview" , ctx )
242242
243243 local suggestion = get_current_suggestion (ctx )
244244 local displayLines = suggestion and vim .split (suggestion .displayText , " \n " , { plain = true }) or {}
245245
246- clear_preview ()
246+ M . clear_preview ()
247247
248248 if not suggestion or # displayLines == 0 then
249249 return
@@ -321,7 +321,7 @@ local function clear(ctx)
321321 ctx = ctx or get_ctx ()
322322 stop_timer ()
323323 cancel_inflight_requests (ctx )
324- update_preview (ctx )
324+ M . update_preview (ctx )
325325 reset_ctx (ctx )
326326end
327327
@@ -352,7 +352,7 @@ local function handle_trigger_request(err, data)
352352 ctx .suggestions = data and data .completions or {}
353353 ctx .choice = 1
354354 ctx .shown_choices = {}
355- update_preview ()
355+ M . update_preview ()
356356end
357357
358358local function trigger (bufnr , timer )
@@ -423,7 +423,7 @@ local function get_suggestions_cycling(callback, ctx)
423423 get_suggestions_cycling_callback (ctx , err , data )
424424 end )
425425 ctx .cycling = id --[[ @as integer]]
426- update_preview (ctx )
426+ M . update_preview (ctx )
427427 end )
428428 end
429429end
@@ -449,7 +449,7 @@ local function schedule(bufnr)
449449 stop_timer ()
450450 end
451451
452- update_preview ()
452+ M . update_preview ()
453453 bufnr = bufnr or vim .api .nvim_get_current_buf ()
454454 copilot ._copilot_timer = vim .fn .timer_start (copilot .debounce , function (timer )
455455 logger .trace (" suggestion schedule timer" , bufnr )
@@ -494,7 +494,7 @@ local function advance(count, ctx)
494494 ctx .choice = # ctx .suggestions
495495 end
496496
497- update_preview (ctx )
497+ M . update_preview (ctx )
498498end
499499
500500--- @param ctx copilot_suggestion_context
@@ -588,7 +588,7 @@ function M.accept(modifier)
588588 ctx .accepted_partial = true
589589 ignore_next_cursor_moved = true
590590 else
591- clear_preview ()
591+ M . clear_preview ()
592592 newText = suggestion .text
593593 end
594594
@@ -641,7 +641,7 @@ function M.accept(modifier)
641641 end
642642
643643 update_ctx_suggestion_position (ctx .choice , new_cursor_line - 1 , last_col , bufnr )
644- update_preview (ctx )
644+ M . update_preview (ctx )
645645 end
646646 end )()
647647end
@@ -687,7 +687,7 @@ function M.dismiss()
687687 local ctx = get_ctx ()
688688 reject ()
689689 clear (ctx )
690- update_preview (ctx )
690+ M . update_preview (ctx )
691691end
692692
693693function M .is_visible ()
0 commit comments