Skip to content

Commit 153b94a

Browse files
committed
JsxText has no leading comments
1 parent ad9c29b commit 153b94a

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ namespace ts {
635635
}
636636

637637
export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) {
638-
return getLeadingCommentRanges(sourceFileOfNode.text, node.pos);
638+
return node.kind !== SyntaxKind.JsxText ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined;
639639
}
640640

641641
export function getLeadingCommentRangesOfNodeFromText(node: Node, text: string) {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: file.jsx
4+
//// <div>
5+
//// // /*0*/
6+
//// /* /*1*/ */
7+
//// /**
8+
//// * /*2*/
9+
//// */
10+
//// foo() /* /*3*/ */
11+
//// // /*4*/
12+
//// /* /*5*/ */
13+
//// /**
14+
//// * /*6*/
15+
//// */
16+
//// </div>
17+
//// <div>
18+
//// // /*7*/
19+
//// /* /*8*/ */
20+
//// /**
21+
//// * /*9*/
22+
//// */
23+
24+
for (let i = 0; i < 10; ++i) {
25+
goTo.marker(i.toString());
26+
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ false);
27+
}

0 commit comments

Comments
 (0)