TypeScript Version: master
Code:
Expected behavior:
ts.getTrailingCommentRanges(text, 0) doesn't return a comment.
Both comments are parsed by ts.getLeadingCommentRanges(text, 0).
Actual behavior:
ts.getTrailingCommentRanges(text, 0) parses // one as a trailing comment.
ts.getLeadingCommentRanges(text, 0) parses both comments.
The special handling of position 0 should also affect trailing comments.
With the current behavior I have to remember to not parse trailing comment ranges at position 0 to avoid duplicates.
Related Issues:
This was part of #28489 where I first proposed changing this behavior.
/cc @rbuckton
TypeScript Version: master
Code:
Expected behavior:
ts.getTrailingCommentRanges(text, 0)doesn't return a comment.Both comments are parsed by
ts.getLeadingCommentRanges(text, 0).Actual behavior:
ts.getTrailingCommentRanges(text, 0)parses// oneas a trailing comment.ts.getLeadingCommentRanges(text, 0)parses both comments.The special handling of position 0 should also affect trailing comments.
With the current behavior I have to remember to not parse trailing comment ranges at position 0 to avoid duplicates.
Related Issues:
This was part of #28489 where I first proposed changing this behavior.
/cc @rbuckton