File tree Expand file tree Collapse file tree 2 files changed +37
-7
lines changed Expand file tree Collapse file tree 2 files changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -915,13 +915,29 @@ namespace ts.Completions {
915
915
}
916
916
}
917
917
else if ( sourceFile . languageVariant === LanguageVariant . JSX ) {
918
- if ( kind === SyntaxKind . LessThanToken ) {
919
- isRightOfOpenTag = true ;
920
- location = contextToken ;
921
- }
922
- else if ( kind === SyntaxKind . SlashToken && contextToken . parent . kind === SyntaxKind . JsxClosingElement ) {
923
- isStartingCloseTag = true ;
924
- location = contextToken ;
918
+ switch ( contextToken . parent . kind ) {
919
+ case SyntaxKind . JsxClosingElement :
920
+ if ( kind === SyntaxKind . SlashToken ) {
921
+ isStartingCloseTag = true ;
922
+ location = contextToken ;
923
+ }
924
+ break ;
925
+
926
+ case SyntaxKind . BinaryExpression :
927
+ if ( ! ( ( contextToken . parent as BinaryExpression ) . left . flags & NodeFlags . ThisNodeHasError ) ) {
928
+ // It has a left-hand side, so we're not in an opening JSX tag.
929
+ break ;
930
+ }
931
+ // fall through
932
+
933
+ case SyntaxKind . JsxSelfClosingElement :
934
+ case SyntaxKind . JsxElement :
935
+ case SyntaxKind . JsxOpeningElement :
936
+ if ( kind === SyntaxKind . LessThanToken ) {
937
+ isRightOfOpenTag = true ;
938
+ location = contextToken ;
939
+ }
940
+ break ;
925
941
}
926
942
}
927
943
}
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts'/>
2
+
3
+ ////var x: Array<numb/*a*/;
4
+ ////[].map<numb/*b*/;
5
+ ////1 < Infini/*c*/;
6
+
7
+ for ( const marker of [ "a" , "b" ] ) {
8
+ goTo . marker ( marker ) ;
9
+ verify . completionListContains ( "number" ) ;
10
+ verify . not . completionListContains ( "SVGNumber" ) ;
11
+ } ;
12
+
13
+ goTo . marker ( "c" ) ;
14
+ verify . completionListContains ( "Infinity" ) ;
You can’t perform that action at this time.
0 commit comments