getTrailingCommentRanges returns comments at the start of the file #29625
Labels
API
Relates to the public API for TypeScript
In Discussion
Not yet reached consensus
Suggestion
An idea for TypeScript
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
The text was updated successfully, but these errors were encountered: