Skip to content

Commit

Permalink
Update lineMap after altering source.text (#2837)
Browse files Browse the repository at this point in the history
Fixes #2680.
  • Loading branch information
lzhoucs authored May 27, 2021
1 parent c83a39a commit 137bb19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/jsii/lib/transforms/ts-comment-replacer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,8 @@ function whiteoutLeadingComments(node: ts.Node, source: ts.SourceFile) {
text = text.slice(0, pos).padEnd(end, ' ') + text.slice(end);
}
});
source.text = text;
if (source.text !== text) {
source.text = text;
(source as any).lineMap = (ts as any).computeLineStarts(text);
}
}

0 comments on commit 137bb19

Please sign in to comment.