-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Serialize package
and SPI doc comments in swiftsourceinfo
#65265
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.
😍
5b453be
to
a92da15
Compare
if (Optional<std::pair<RawComment, bool>> RC = Context.getRawComment(this)) { | ||
auto P = RC.value(); | ||
if (!SerializedOK || P.second) | ||
return P.first; | ||
} |
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.
Heh, just noticed this predicate was wrong anyway, and allowed us to retrieve a serialized entry from the cache even if !SerializedOK
.
30b2bbf
to
575ae2b
Compare
575ae2b
to
754f032
Compare
754f032
to
b0fd7d1
Compare
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.
LGTM, thanks Hamish. Might be good to get a review from @nkcsgexi as well.
// Skip the decl if it does not have a comment. Note this means | ||
// we'll only serialize "direct" brief comments, but that's okay | ||
// because clients can compute the semantic brief comment themselves. |
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.
Seems weird that we output the brief comment to me at all. @nkcsgexi do you remember why this is the case?
oh, this is a great idea to include internal doc comment in the source info file! |
It doesn't seem like there's any client that's actually taking advantage of setting it to `false`, and its default value of `false` is more likely than not going to cause clients to accidentally miss comments that they may want. In fact, this was exactly the case for code completion's brief field. Finally, the parameter wasn't even consistently applied, as we would attempt to deserialize swiftdoc comments even if it were `false`.
Turn these ASTContext cached computations into request evaluator cached computations.
Previously we were using the same set of conditions for serializing as for swiftdoc, so excluded them. However it's reasonable to have them in the swiftsourceinfo.
Match the format of the spi and package variants of these tests.
If we have both loaded a swiftdoc, and the decl we have should have had its doc comment serialized into it, we can check it without needing to fall back to the swiftsourceinfo. This requires a couple of refactorings: - Factoring out the `shouldIncludeDecl` logic into `getDocCommentSerializationTargetFor` for determining whether a doc comment should end up in the swiftdoc or not. - Factoring out `CommentProviderFinder` for searching for the doc providing comment decl for brief comments, in order to allow us to avoid querying the raw comment when searching for it. This has the added bonus of meaning we no longer need to fall back to parsing the raw comment for the brief comment if the comment is provided by another decl in the swiftdoc. This diff is best viewed without whitespace.
Make it clear that we will walk the comment providing decls if needed.
b0fd7d1
to
be31c22
Compare
@swift-ci please test |
Happy to take care of further feedback in a follow-up |
Requestify raw and brief comment computation, and allow
package
and SPI doc comments to be serialized in swiftsourceinfo. In the future we may want to emit a separate private swiftdoc for SPI doc comments, but for now we can just include them in the swiftsourceinfo to at least allow them to be picked up for local builds.