@@ -1616,6 +1616,9 @@ namespace ts {
1616
1616
public static jsxOpenTagName = "jsx open tag name" ;
1617
1617
public static jsxCloseTagName = "jsx close tag name" ;
1618
1618
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" ;
1619
1622
}
1620
1623
1621
1624
export const enum ClassificationType {
@@ -1640,7 +1643,9 @@ namespace ts {
1640
1643
jsxOpenTagName = 19 ,
1641
1644
jsxCloseTagName = 20 ,
1642
1645
jsxSelfClosingTagName = 21 ,
1643
- jsxAttribute = 22
1646
+ jsxAttribute = 22 ,
1647
+ jsxText = 23 ,
1648
+ jsxAttributeStringLiteralValue = 24 ,
1644
1649
}
1645
1650
1646
1651
/// Language Service
@@ -6595,6 +6600,9 @@ namespace ts {
6595
6600
case ClassificationType . jsxOpenTagName : return ClassificationTypeNames . jsxOpenTagName ;
6596
6601
case ClassificationType . jsxCloseTagName : return ClassificationTypeNames . jsxCloseTagName ;
6597
6602
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 ;
6598
6606
}
6599
6607
}
6600
6608
@@ -6803,12 +6811,12 @@ namespace ts {
6803
6811
}
6804
6812
}
6805
6813
6806
- function classifyToken ( token : Node ) : void {
6814
+ function classifyTokenOrJsxText ( token : Node ) : void {
6807
6815
if ( nodeIsMissing ( token ) ) {
6808
6816
return ;
6809
6817
}
6810
6818
6811
- const tokenStart = classifyLeadingTriviaAndGetTokenStart ( token ) ;
6819
+ const tokenStart = token . kind === SyntaxKind . JsxText ? token . pos : classifyLeadingTriviaAndGetTokenStart ( token ) ;
6812
6820
6813
6821
const tokenWidth = token . end - tokenStart ;
6814
6822
Debug . assert ( tokenWidth >= 0 ) ;
@@ -6844,7 +6852,8 @@ namespace ts {
6844
6852
// the '=' in a variable declaration is special cased here.
6845
6853
if ( token . parent . kind === SyntaxKind . VariableDeclaration ||
6846
6854
token . parent . kind === SyntaxKind . PropertyDeclaration ||
6847
- token . parent . kind === SyntaxKind . Parameter ) {
6855
+ token . parent . kind === SyntaxKind . Parameter ||
6856
+ token . parent . kind === SyntaxKind . JsxAttribute ) {
6848
6857
return ClassificationType . operator ;
6849
6858
}
6850
6859
}
@@ -6863,7 +6872,7 @@ namespace ts {
6863
6872
return ClassificationType . numericLiteral ;
6864
6873
}
6865
6874
else if ( tokenKind === SyntaxKind . StringLiteral || tokenKind === SyntaxKind . StringLiteralType ) {
6866
- return ClassificationType . stringLiteral ;
6875
+ return token . parent . kind === SyntaxKind . JsxAttribute ? ClassificationType . jsxAttributeStringLiteralValue : ClassificationType . stringLiteral ;
6867
6876
}
6868
6877
else if ( tokenKind === SyntaxKind . RegularExpressionLiteral ) {
6869
6878
// TODO: we should get another classification type for these literals.
@@ -6873,6 +6882,9 @@ namespace ts {
6873
6882
// TODO (drosen): we should *also* get another classification type for these literals.
6874
6883
return ClassificationType . stringLiteral ;
6875
6884
}
6885
+ else if ( tokenKind === SyntaxKind . JsxText ) {
6886
+ return ClassificationType . jsxText ;
6887
+ }
6876
6888
else if ( tokenKind === SyntaxKind . Identifier ) {
6877
6889
if ( token ) {
6878
6890
switch ( token . parent . kind ) {
@@ -6946,8 +6958,8 @@ namespace ts {
6946
6958
const children = element . getChildren ( sourceFile ) ;
6947
6959
for ( let i = 0 , n = children . length ; i < n ; i ++ ) {
6948
6960
const child = children [ i ] ;
6949
- if ( isToken ( child ) ) {
6950
- classifyToken ( child ) ;
6961
+ if ( isToken ( child ) || child . kind === SyntaxKind . JsxText ) {
6962
+ classifyTokenOrJsxText ( child ) ;
6951
6963
}
6952
6964
else {
6953
6965
// Recurse into our child nodes.
0 commit comments