@@ -660,9 +660,10 @@ class AssistEditorContextPanel {
660
660
}
661
661
662
662
if (
663
+ riskId === 22 &&
663
664
location . type === 'whereClause' &&
664
665
! location . subquery &&
665
- ( location . missing || riskId === 22 )
666
+ location . missing
666
667
) {
667
668
this . activeEditor ( ) . moveCursorToPosition ( {
668
669
row : location . location . last_line - 1 ,
@@ -694,6 +695,42 @@ class AssistEditorContextPanel {
694
695
return false ;
695
696
}
696
697
698
+ if (
699
+ riskId === 17 &&
700
+ location . type === 'limitClause' &&
701
+ ! location . subquery &&
702
+ location . missing
703
+ ) {
704
+ this . activeEditor ( ) . moveCursorToPosition ( {
705
+ row : location . location . last_line - 1 ,
706
+ column : location . location . last_column - 1
707
+ } ) ;
708
+ this . activeEditor ( ) . clearSelection ( ) ;
709
+
710
+ if ( / \S $ / . test ( this . activeEditor ( ) . getTextBeforeCursor ( ) ) ) {
711
+ this . activeEditor ( ) . session . insert ( this . activeEditor ( ) . getCursorPosition ( ) , ' ' ) ;
712
+ }
713
+
714
+ const operation = 'LIMIT' ;
715
+ this . activeEditor ( ) . session . insert (
716
+ this . activeEditor ( ) . getCursorPosition ( ) ,
717
+ isLowerCase ? operation . toLowerCase ( ) : operation
718
+ ) ;
719
+ this . activeEditor ( ) . focus ( ) ;
720
+
721
+ if ( riskId === 17 ) {
722
+ huePubSub . publish ( 'editor.autocomplete.temporary.sort.override' , {
723
+ partitionColumnsFirst : true
724
+ } ) ;
725
+ }
726
+
727
+ window . setTimeout ( ( ) => {
728
+ this . activeEditor ( ) . execCommand ( 'startAutocomplete' ) ;
729
+ } , 1 ) ;
730
+
731
+ return false ;
732
+ }
733
+
697
734
return true ;
698
735
} ) ;
699
736
}
0 commit comments