Skip to content

Commit cfc6ed2

Browse files
committed
tsx : support tags in language service semantic tokenizer
1 parent 9c28480 commit cfc6ed2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/services/services.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,9 @@ namespace ts {
16111611
public static typeAliasName = "type alias name";
16121612
public static parameterName = "parameter name";
16131613
public static docCommentTagName = "doc comment tag name";
1614+
public static jsxOpenTagName = "jsx open tag name";
1615+
public static jsxCloseTagName = "jsx close tag name";
1616+
public static jsxSelfClosingTagName = "jsx self closing tag name";
16141617
}
16151618

16161619
export const enum ClassificationType {
@@ -1632,6 +1635,9 @@ namespace ts {
16321635
typeAliasName = 16,
16331636
parameterName = 17,
16341637
docCommentTagName = 18,
1638+
jsxOpenTagName = 19,
1639+
jsxCloseTagName = 20,
1640+
jsxSelfClosingTagName = 21,
16351641
}
16361642

16371643
/// Language Service
@@ -6619,6 +6625,9 @@ namespace ts {
66196625
case ClassificationType.typeAliasName: return ClassificationTypeNames.typeAliasName;
66206626
case ClassificationType.parameterName: return ClassificationTypeNames.parameterName;
66216627
case ClassificationType.docCommentTagName: return ClassificationTypeNames.docCommentTagName;
6628+
case ClassificationType.jsxOpenTagName: return ClassificationTypeNames.jsxOpenTagName;
6629+
case ClassificationType.jsxCloseTagName: return ClassificationTypeNames.jsxCloseTagName;
6630+
case ClassificationType.jsxSelfClosingTagName: return ClassificationTypeNames.jsxSelfClosingTagName;
66226631
}
66236632
}
66246633

@@ -6931,6 +6940,23 @@ namespace ts {
69316940
}
69326941
return;
69336942

6943+
case SyntaxKind.JsxOpeningElement:
6944+
if ((<JsxOpeningElement>token.parent).tagName === token) {
6945+
return ClassificationType.jsxOpenTagName;
6946+
}
6947+
return;
6948+
6949+
case SyntaxKind.JsxClosingElement:
6950+
if ((<JsxClosingElement>token.parent).tagName === token) {
6951+
return ClassificationType.jsxCloseTagName;
6952+
}
6953+
return;
6954+
6955+
case SyntaxKind.JsxSelfClosingElement:
6956+
if ((<JsxSelfClosingElement>token.parent).tagName === token) {
6957+
return ClassificationType.jsxSelfClosingTagName;
6958+
}
6959+
return;
69346960
}
69356961
}
69366962

0 commit comments

Comments
 (0)