diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 76d242e8b08..8c82b9d26df 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -635,7 +635,7 @@ namespace ts { } export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) { - return getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + return node.kind !== SyntaxKind.JsxText ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : undefined; } export function getLeadingCommentRangesOfNodeFromText(node: Node, text: string) { diff --git a/tests/cases/fourslash/isInMultiLineCommentJsxText.ts b/tests/cases/fourslash/isInMultiLineCommentJsxText.ts new file mode 100644 index 00000000000..db88f6b9a55 --- /dev/null +++ b/tests/cases/fourslash/isInMultiLineCommentJsxText.ts @@ -0,0 +1,27 @@ +/// + +// @Filename: file.jsx +////
+//// // /*0*/ +//// /* /*1*/ */ +//// /** +//// * /*2*/ +//// */ +//// foo() /* /*3*/ */ +//// // /*4*/ +//// /* /*5*/ */ +//// /** +//// * /*6*/ +//// */ +////
+////
+//// // /*7*/ +//// /* /*8*/ */ +//// /** +//// * /*9*/ +//// */ + +for (let i = 0; i < 10; ++i) { + goTo.marker(i.toString()); + verify.not.isInCommentAtPosition(/*onlyMultiLine*/ false); +}