-
Notifications
You must be signed in to change notification settings - Fork 123
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
drop an "Extended Symbol" page when its children are curated elsewhere #541
drop an "Extended Symbol" page when its children are curated elsewhere #541
Conversation
@swift-ci Please test |
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 PR, this is definitely a useful addition!
One thing I'd like to discuss, though, is how this change affects references to extension pages that get dropped. What would happen if you added a (non-curating) reference to ``Swift/Array``
to your test example (on a page that is not removed, e.g. ``ModuleWithSingleExtension``
, or on a page that is also removed, e.g. ``Swift``
).
Could you please document the intended behavior for both scenarios in a test case? I'm also not sure what the ideal behavior is, really.
In the case where the referencing page is also removed (``Swift``
links to ``Swift/Array``
), I think we should just make sure that we don't generate a warning. This might very well already be the case with your implementation.
In the case where the referencing page is not removed (``ModuleWithSingleExtension``
links to ``Swift/Array``
), I see three options:
- We do not remove the referenced page, because the reference suggests it is still relevant.
- We remove the referenced page, and we emit a warning with a specialised diagnostic for the actually "valid" reference.
- We remove the referenced page, and silently downgrade the reference to a monospaced text without link.
@theMomax Thanks for the review! Right now it looks like the behavior for when you actually curate or reference a page is a bit awkward:
I think what i would want to happen in the case of a non-curating reference is your option (2), with maybe some extra logic for if there are extension files for the extension pages that keep them "live". I'll take a look at adding these suggestions. |
9a0c21c
to
fc2649d
Compare
I just pushed a couple commits to handle @theMomax's review comments. They've added the following functionality:
|
@swift-ci Please test |
fc2649d
to
8c24fee
Compare
@swift-ci Please test |
I'm seeing an issue with symbols that are included in relationships sections. Here I built ArgumentParser with:
The resulting docs are much nicer now (they exclude all of the empty Ideally I think these symbols would still appear but as monospace references instead:
|
@ethan-kusters Oh right, i wanted to look into that! 😅 I don't know offhand where those are rendered, but i can look at that next. |
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
5c18fe6
to
aabda5e
Compare
@swift-ci Please test |
I'm not sure if it should be resolved yet, but even with the latest changes I'm still able to reproduce the issue I was seeing with ArgumentParser. |
@ethan-kusters Oh interesting! I fixed the broken links when you reference them from a symbol link, but not when they're automatically inserted like that. Let me take a look. |
aabda5e
to
a7a73f0
Compare
@ethan-kusters I just pushed up a solution. Can you try it now? |
@swift-ci Please test |
Woot! Looks great. In other cases like this we include the module namespace (i.e. Is it simple to do the same thing here? If not – we can definitely leave it for a future PR. |
That seems doable - the title defers to the |
That would be great. Thank you! |
@ethan-kusters Just filed #554 to track it. |
swiftlang#541) rdar://107729630 Bundles with extension block symbols generate placeholder "Extended Symbol" pages to automatically curate extension symbols. However, if the symbols are then curated elsewhere, the "Extended Symbol" pages are left confusingly empty. Drop these pages if they have no child pages remaining. An "Extended Symbol" page will remain if an extension markdown file is provided for it, even if its children are curated elsewhere. Links to these dropped pages will generate a warning and be converted to code voice in the final rendering. References in automatically generated symbol-relationship page sections will not generate a warning, but they will be converted to code voice as well.
Bug/issue #, if applicable: rdar://107729630
Summary
When Swift-DocC gets symbol graphs with extension block symbols, it creates "Extended Module/Class/Structure/etc" symbols to automatically curate the extension symbols into. However, if the extension symbols are then curated in the rest of the documentation hierarchy, these extra symbols are left in the topic graph and create empty pages that don't need to be there. This PR adds a pass to
DocumentationContext.register(_:)
to drop these symbols if all their children have been curated elsewhere. (This pass is done recursively, so "Extended Module" pages will drop if all their child "Extended Class/Structure/etc" pages are also dropped.)Dependencies
None
Testing
The following code was used to test this functionality:
Steps:
ModuleWithSingleExtension
test fixture added in this PR, which can be used as a shortcut.)Swift
, nor the "Extended Structure" page forArray
.Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded