@@ -1616,6 +1616,9 @@ namespace ts {
16161616 public static jsxOpenTagName = "jsx open tag name" ;
16171617 public static jsxCloseTagName = "jsx close tag name" ;
16181618 public static jsxSelfClosingTagName = "jsx self closing tag name" ;
1619+ public static jsxAttribute = "jsx attribute" ;
1620+ public static jsxText = "jsx text" ;
1621+ public static jsxAttributeStringLiteralValue = "jsx attribute string literal value" ;
16191622 }
16201623
16211624 export const enum ClassificationType {
@@ -1640,7 +1643,9 @@ namespace ts {
16401643 jsxOpenTagName = 19 ,
16411644 jsxCloseTagName = 20 ,
16421645 jsxSelfClosingTagName = 21 ,
1643- jsxAttribute = 22
1646+ jsxAttribute = 22 ,
1647+ jsxText = 23 ,
1648+ jsxAttributeStringLiteralValue = 24 ,
16441649 }
16451650
16461651 /// Language Service
@@ -6595,6 +6600,9 @@ namespace ts {
65956600 case ClassificationType . jsxOpenTagName : return ClassificationTypeNames . jsxOpenTagName ;
65966601 case ClassificationType . jsxCloseTagName : return ClassificationTypeNames . jsxCloseTagName ;
65976602 case ClassificationType . jsxSelfClosingTagName : return ClassificationTypeNames . jsxSelfClosingTagName ;
6603+ case ClassificationType . jsxAttribute : return ClassificationTypeNames . jsxAttribute ;
6604+ case ClassificationType . jsxText : return ClassificationTypeNames . jsxText ;
6605+ case ClassificationType . jsxAttributeStringLiteralValue : return ClassificationTypeNames . jsxAttributeStringLiteralValue ;
65986606 }
65996607 }
66006608
@@ -6803,12 +6811,12 @@ namespace ts {
68036811 }
68046812 }
68056813
6806- function classifyToken ( token : Node ) : void {
6814+ function classifyTokenOrJsxText ( token : Node ) : void {
68076815 if ( nodeIsMissing ( token ) ) {
68086816 return ;
68096817 }
68106818
6811- const tokenStart = classifyLeadingTriviaAndGetTokenStart ( token ) ;
6819+ const tokenStart = token . kind === SyntaxKind . JsxText ? token . pos : classifyLeadingTriviaAndGetTokenStart ( token ) ;
68126820
68136821 const tokenWidth = token . end - tokenStart ;
68146822 Debug . assert ( tokenWidth >= 0 ) ;
@@ -6844,7 +6852,8 @@ namespace ts {
68446852 // the '=' in a variable declaration is special cased here.
68456853 if ( token . parent . kind === SyntaxKind . VariableDeclaration ||
68466854 token . parent . kind === SyntaxKind . PropertyDeclaration ||
6847- token . parent . kind === SyntaxKind . Parameter ) {
6855+ token . parent . kind === SyntaxKind . Parameter ||
6856+ token . parent . kind === SyntaxKind . JsxAttribute ) {
68486857 return ClassificationType . operator ;
68496858 }
68506859 }
@@ -6863,7 +6872,7 @@ namespace ts {
68636872 return ClassificationType . numericLiteral ;
68646873 }
68656874 else if ( tokenKind === SyntaxKind . StringLiteral || tokenKind === SyntaxKind . StringLiteralType ) {
6866- return ClassificationType . stringLiteral ;
6875+ return token . parent . kind === SyntaxKind . JsxAttribute ? ClassificationType . jsxAttributeStringLiteralValue : ClassificationType . stringLiteral ;
68676876 }
68686877 else if ( tokenKind === SyntaxKind . RegularExpressionLiteral ) {
68696878 // TODO: we should get another classification type for these literals.
@@ -6873,6 +6882,9 @@ namespace ts {
68736882 // TODO (drosen): we should *also* get another classification type for these literals.
68746883 return ClassificationType . stringLiteral ;
68756884 }
6885+ else if ( tokenKind === SyntaxKind . JsxText ) {
6886+ return ClassificationType . jsxText ;
6887+ }
68766888 else if ( tokenKind === SyntaxKind . Identifier ) {
68776889 if ( token ) {
68786890 switch ( token . parent . kind ) {
@@ -6946,8 +6958,8 @@ namespace ts {
69466958 const children = element . getChildren ( sourceFile ) ;
69476959 for ( let i = 0 , n = children . length ; i < n ; i ++ ) {
69486960 const child = children [ i ] ;
6949- if ( isToken ( child ) ) {
6950- classifyToken ( child ) ;
6961+ if ( isToken ( child ) || child . kind === SyntaxKind . JsxText ) {
6962+ classifyTokenOrJsxText ( child ) ;
69516963 }
69526964 else {
69536965 // Recurse into our child nodes.
0 commit comments