@@ -196,6 +196,8 @@ impl EditPredictionProvider for CopilotCompletionProvider {
196196 }
197197
198198 fn discard ( & mut self , cx : & mut Context < Self > ) {
199+ self . completions . clear ( ) ;
200+
199201 let settings = AllLanguageSettings :: get_global ( cx) ;
200202
201203 let copilot_enabled = settings. show_edit_predictions ( None , cx) ;
@@ -437,8 +439,16 @@ mod tests {
437439 assert_eq ! ( editor. display_text( cx) , "one.c \n two\n three\n " ) ;
438440 assert_eq ! ( editor. text( cx) , "one.c \n two\n three\n " ) ;
439441
440- // When undoing the previously active suggestion is shown again.
442+ // When undoing the previously active suggestion isn't shown again.
441443 editor. undo ( & Default :: default ( ) , window, cx) ;
444+ assert ! ( !editor. has_active_edit_prediction( ) ) ;
445+ assert_eq ! ( editor. display_text( cx) , "one.c\n two\n three\n " ) ;
446+ assert_eq ! ( editor. text( cx) , "one.c\n two\n three\n " ) ;
447+
448+ editor. next_edit_prediction ( & Default :: default ( ) , window, cx) ;
449+ } ) ;
450+ executor. advance_clock ( COPILOT_DEBOUNCE_TIMEOUT ) ;
451+ cx. editor ( |editor, _, cx| {
442452 assert ! ( editor. has_active_edit_prediction( ) ) ;
443453 assert_eq ! ( editor. display_text( cx) , "one.copilot2\n two\n three\n " ) ;
444454 assert_eq ! ( editor. text( cx) , "one.c\n two\n three\n " ) ;
0 commit comments