JsxText has no leading comments

This commit is contained in:
Arthur Ozga 2017-08-16 15:28:47 -07:00
parent ad9c29b928
commit 153b94aeb4
2 changed files with 28 additions and 1 deletions

View File

@ -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) {

View File

@ -0,0 +1,27 @@
/// <reference path="fourslash.ts" />
// @Filename: file.jsx
//// <div>
//// // /*0*/
//// /* /*1*/ */
//// /**
//// * /*2*/
//// */
//// foo() /* /*3*/ */
//// // /*4*/
//// /* /*5*/ */
//// /**
//// * /*6*/
//// */
//// </div>
//// <div>
//// // /*7*/
//// /* /*8*/ */
//// /**
//// * /*9*/
//// */
for (let i = 0; i < 10; ++i) {
goTo.marker(i.toString());
verify.not.isInCommentAtPosition(/*onlyMultiLine*/ false);
}