-
Notifications
You must be signed in to change notification settings - Fork 442
Add commentValue
property to Trivia
for cleaned comments
#2966
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
base: main
Are you sure you want to change the base?
Conversation
- Copied changes from PR swiftlang#2578 (swiftlang#2578) - Original work by @adammcarter - Manual copy due to inaccessible original branch
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.
Thanks for addressing the issue, @zyadtaha. I think the PR still needs some polishing regarding indentation handling. I left a few comments inline.
3ad450f
to
c23e3dc
Compare
Thanks for the feedback, @ahoppen! I've addressed the comments—let me know if anything else needs attention. |
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.
Thanks for the adjustments. I left a few more edge cases to consider as comments.
Add release note for Trivia.commentValue Address PR review Address second review
c23e3dc
to
04f700e
Compare
Hey @ahoppen, just wanted to check if there's anything else needed from my side on this PR. Let me know if you have any concerns. Thanks! |
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.
Thanks for the updates. I think there are still a few more issues that need to be addressed.
Hey @ahoppen, I've pushed my updates. For your last two comments, I've added responses—let me know your feedback when you get a chance. Thanks! |
8df001d
to
52fdc83
Compare
…er comments found while addressing those
I addressed my own review comments in a 2197103, which I pushed to your branch. Could you check if these changes make sense to you? |
Thank you! I pulled the changes and reviewed the new logic and tests, and everything looks great to me. I really appreciated the detailed doc comments; they helped me understand your approach much better. I also liked how you split the tests into separate functions since it makes things much clearer. I just had one question: why did you move the Also, if you have any feedback on my code, communication, or anything I could improve, I’d be very grateful. I want to make sure I’m not wasting your time and that I'm learning as much as possible through this process. |
Thanks for checking that the changes look good to you.
The implementation of
You did great work to get things started. I just figured that it was easier to fix the edge cases instead of repeatedly pointing out edge cases and then discovering more after you addressed them. Thinking of all possible edge cases is a big part of developing compiler-related tooling and it’s hard to teach that general way of thinking in pull request comments. |
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'm not sure about concatenating the pieces. The current behavior sounds fragile and not predictable.
TriviaPiece.commentValue: String?
(as #1890 requested) would make more sense and we should implement that at least. But it's also debatable what to do with the space after //
.
Trivia.commentValue: String?
should be IMO a high-level API based on TriviaPiece.commentValue
, but the concatenating behavior mixing trivia kinds should be discussed more.
Maybe Trivia.docCommentValue: String?
that would only handle .docLineComment
/.docBlockComment
makes more sense.
} | ||
comments.append(processedText[...]) | ||
case .lineComment(let text), .docLineComment(let text): | ||
if hasBlockComment { |
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.
Here we allow
/// Foo Bar
/// This is a doc-comment.
// @_spi(Testing)
public fooBar() {}
resulting "Foo Bar\nThis is a doc-comment\n@_spi(Testing)"
, but not
/**
* Foo Bar
* This is a doc-comment.
*/
// @_spi(Testing)
public fooBar() {}
Not sure about this case.
I appreciate the thoughtful feedback! I agree that
Your suggestion of |
This PR continues the work from #2578, addressing the review comments and refining the behavior of
Trivia.commentValue
.