Skip to content

Add tooltip with required components for trait tags on docs.rs #18370

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Weihnachtsbaum
Copy link

Objective

To see a component's required components in the docs, you first have to find the Component impl which can be annoying.

Solution

Add a tooltip to the Component and Immutable Component trait tags which lists the required components. The components in that list link to their own doc page.

Testing

Build the docs locally:

RUSTDOCFLAGS="--html-after-content docs-rs/trait-tags.html --cfg docsrs_dep" RUSTFLAGS="--cfg docsrs_dep" cargo doc --no-deps -p <some_bevy_package>

Showcase

Screenshot 2025-03-17 215044

Copy link
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-ECS Entities, components, systems, and events X-Contentious There are nontrivial implications that should be thought through S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 17, 2025
@mockersf
Copy link
Member

I don't think we want to go in that direction.

The plan is to upstream the tags to rustdoc, and I don't see this tooltip as having enough general value for other crates.
This is also not very discoverable

@Weihnachtsbaum
Copy link
Author

The plan is to upstream the tags to rustdoc

I didn't know that. I guess the tooltips could still be used for the bevy docs with the custom html, even if the trait tags get upstreamed, but I see that it could complicate things.

This is also not very discoverable

If we want people to know about it, we can just mention it in the release notes. Also I think that actually a lot of users would just find it out by accidentally hovering over the tags. And even if that isn't the case, I still think that something that's useful should be kept, even if not everyone knows about it.

But of course cost of maintaining vs. value has to be considered, which I can't assess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Docs An addition or correction to our documentation S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants