@@ -605,6 +605,48 @@ public void Inline_HistoryAndPluginSource_Acceptance()
605
605
Assert . NotNull ( _mockedMethods . commandHistory ) ;
606
606
Assert . Equal ( 1 , _mockedMethods . commandHistory . Count ) ;
607
607
Assert . Equal ( "netsh show me" , _mockedMethods . commandHistory [ 0 ] ) ;
608
+
609
+ _mockedMethods . ClearPredictionFields ( ) ;
610
+ SetHistory ( "netsh show me" ) ;
611
+ Test ( "netsh SOME TEXT AFTER" , Keys (
612
+ "netsh" , CheckThat ( ( ) => AssertScreenIs ( 1 ,
613
+ TokenClassification . Command , "netsh" ,
614
+ TokenClassification . InlinePrediction , " show me" ) ) ,
615
+ // Yeah, we still have `OnSuggestionDisplayed` fired, from the typing of each character of `nets`.
616
+ CheckThat ( ( ) => AssertDisplayedSuggestions ( count : 1 , predictorId_1 , MiniSessionId , countOrIndex : - 1 ) ) ,
617
+ CheckThat ( ( ) => _mockedMethods . ClearPredictionFields ( ) ) ,
618
+
619
+ // Now mimic pressing a space key. This will trigger the refreshing of suggestions even though the
620
+ // current history suggestion still applies to the new input, because plugin is in use and we favor
621
+ // plugin over history results.
622
+ ' ' , CheckThat ( ( ) => AssertScreenIs ( 1 ,
623
+ TokenClassification . Command , "netsh" ,
624
+ TokenClassification . None , " " ,
625
+ TokenClassification . InlinePrediction , " SOME TEXT AFTER" ) ) ,
626
+ CheckThat ( ( ) => AssertDisplayedSuggestions ( count : 1 , predictorId_1 , MiniSessionId , countOrIndex : - 1 ) ) ,
627
+ CheckThat ( ( ) => Assert . Equal ( Guid . Empty , _mockedMethods . acceptedPredictorId ) ) ,
628
+ CheckThat ( ( ) => Assert . Null ( _mockedMethods . acceptedSuggestion ) ) ,
629
+ CheckThat ( ( ) => Assert . Null ( _mockedMethods . commandHistory ) ) ,
630
+
631
+ CheckThat ( ( ) => _mockedMethods . ClearPredictionFields ( ) ) ,
632
+ // 'RightArrow' will trigger 'OnSuggestionAccepted' as the suggestion is now from plugin.
633
+ _ . RightArrow , CheckThat ( ( ) => AssertScreenIs ( 1 ,
634
+ TokenClassification . Command , "netsh" ,
635
+ TokenClassification . None , " SOME TEXT AFTER" ) ) ,
636
+ CheckThat ( ( ) => Assert . Empty ( _mockedMethods . displayedSuggestions ) ) ,
637
+ CheckThat ( ( ) => Assert . Equal ( predictorId_1 , _mockedMethods . acceptedPredictorId ) ) ,
638
+ CheckThat ( ( ) => Assert . Equal ( "netsh SOME TEXT AFTER" , _mockedMethods . acceptedSuggestion ) ) ,
639
+ CheckThat ( ( ) => Assert . Null ( _mockedMethods . commandHistory ) )
640
+ ) ) ;
641
+
642
+ Assert . Empty ( _mockedMethods . displayedSuggestions ) ;
643
+ Assert . Equal ( predictorId_1 , _mockedMethods . acceptedPredictorId ) ;
644
+ Assert . Equal ( "netsh SOME TEXT AFTER" , _mockedMethods . acceptedSuggestion ) ;
645
+ Assert . NotNull ( _mockedMethods . commandHistory ) ;
646
+ Assert . Equal ( 2 , _mockedMethods . commandHistory . Count ) ;
647
+ Assert . Equal ( "netsh show me" , _mockedMethods . commandHistory [ 0 ] ) ;
648
+ Assert . Equal ( "netsh SOME TEXT AFTER" , _mockedMethods . commandHistory [ 1 ] ) ;
649
+ _mockedMethods . ClearPredictionFields ( ) ;
608
650
}
609
651
610
652
[ SkippableFact ]
0 commit comments