-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix bug: Include comment for @param tag with nested tag #23276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of questions about the change and its tests.
@@ -6526,6 +6526,8 @@ namespace ts { | |||
const result = target === PropertyLikeParse.Parameter ? | |||
<JSDocParameterTag>createNode(SyntaxKind.JSDocParameterTag, atToken.pos) : | |||
<JSDocPropertyTag>createNode(SyntaxKind.JSDocPropertyTag, atToken.pos); | |||
let comment: string | undefined; | |||
if (indent !== undefined) comment = parseTagComments(indent + scanner.getStartPos() - atToken.pos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only nested @param
s were missing comments before this change, where was the comment parsed for non-nested ones? Does this change now parse the comments for all @param
s here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, previously it was always done at the bottom of parseTag
. But that didn't work if the comment had already been skipped.
parsesCorrectly("Nested @param tags", | ||
`/** | ||
* @param {object} o Doc doc | ||
* @param {string} o.f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was the comments on nested @param
that were incorrectly skipped. Shouldn’t this test include some comments for this line too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseChildParameterOrPropertyTag
begins by skipping a line. So it's the comment that comes before the child that was skipped. But I'll add some comments for that line too.
Fixes #23221 (comment)
parseChildParameterOrPropertyTag
contains code to skip ahead to the next line -- this means that the comment goes missing. We should probably never skip a comment, but that would be a bigger change than this.