File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/codewhisperer/service Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -829,7 +829,11 @@ export class ClassifierTrigger {
829
829
const leftContextLines = leftContext . split ( / \r ? \n / )
830
830
const leftContextAtCurrentLine = leftContextLines [ leftContextLines . length - 1 ]
831
831
const tokens = leftContextAtCurrentLine . trim ( ) . split ( ' ' )
832
- const keyword = tokens [ tokens . length - 1 ]
832
+ let keyword = ''
833
+ const lastToken = tokens [ tokens . length - 1 ]
834
+ if ( lastToken && lastToken . length > 1 ) {
835
+ keyword = lastToken
836
+ }
833
837
const lengthOfLeftCurrent = leftContextLines [ leftContextLines . length - 1 ] . length
834
838
const lengthOfLeftPrev = leftContextLines [ leftContextLines . length - 2 ] ?. length ?? 0
835
839
const lengthOfRight = rightContext . trim ( ) . length
@@ -914,7 +918,11 @@ export class ClassifierTrigger {
914
918
const leftContextLines = leftContext . split ( / \r ? \n / )
915
919
const leftContextAtCurrentLine = leftContextLines [ leftContextLines . length - 1 ]
916
920
const tokens = leftContextAtCurrentLine . trim ( ) . split ( ' ' )
917
- const keyword = tokens [ tokens . length - 1 ]
921
+ let keyword = ''
922
+ const lastToken = tokens [ tokens . length - 1 ]
923
+ if ( lastToken && lastToken . length > 1 ) {
924
+ keyword = lastToken
925
+ }
918
926
const lengthOfLeftCurrent = leftContextLines [ leftContextLines . length - 1 ] . length
919
927
const lengthOfLeftPrev = leftContextLines [ leftContextLines . length - 2 ] ?. length ?? 0
920
928
const lengthOfRight = rightContext . trim ( ) . length
You can’t perform that action at this time.
0 commit comments