Skip to content

[5.9] Serialize package and SPI doc comments in swiftsourceinfo #65462

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

Merged
merged 7 commits into from
May 3, 2023

Conversation

hamishknight
Copy link
Contributor

5.9 cherry-pick of #65265

  • Explanation: Allows documentation comments on package and SPI declarations to be accessible to local clients that have access to the serialized swiftsourceinfo.
  • Scope: Affects editor functionality for references to SPI and package decls.
  • Issue: rdar://108601688
  • Risk: Low/Medium, this patch does include quite a bit of refactoring, but the change itself is otherwise quite straightforward, we now just include SPI and package decls when serializing swiftsourceinfo, which should have little risk.
  • Testing: Added tests to test suite.
  • Reviewers: Ben Barham, Alex Hoppen, Victoria Mitchell

@hamishknight hamishknight requested a review from a team as a code owner April 27, 2023 11:25
@hamishknight hamishknight added the 🍒 release cherry pick Flag: Release branch cherry picks label May 2, 2023
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.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit 1994869 into swiftlang:release/5.9 May 3, 2023
@hamishknight hamishknight deleted the whats-up-doc-5.9 branch May 3, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants