-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
rustdoc search: Allow to filter on multiple crates #115802
base: master
Are you sure you want to change the base?
rustdoc search: Allow to filter on multiple crates #115802
Conversation
The job Click to see the possible cause of the failure (guessed by this bot)
|
☔ The latest upstream changes (presumably #115820) made this pull request unmergeable. Please resolve the merge conflicts. |
The design of this control makes it easier to search multiple crates at once, at the cost of making it more tedious to switch from searching one crate to searching another. I'm not sure that's true. #99469 implements a more comprehensive tool for advanced searches. I think this feature makes more sense as part of that form. |
Absolutely. I have a few ideas for improvements which I listed but I'm not sure if the end result will still be good.
For this one, we'll definitely need a designer or at least someone who can make a sketch that could be implemented because this is really bad currently. |
This is something that was discussed some time ago (can't find where though...) so I finally took some time to write a first draft.
Motivation
As a user of a group of crates with FFI counterpart (like gtk-rs, docs available here), I want to not only be able to pick one crate to run the search on but instead pick multiple crates that I want to exclude so that I can exclude results from FFI crates.
Adding this feature allows to decide not only which crate you want to include but also which crates you want to exclude from search results.
Another example is: you're using
bevy
and a lot of additional crates to add more functionalities (likebevy_egui
) and you want to look at how to get cursor position in bothbevy
andbevy_egui
without all other crates. This feature allows to do it in one search as well.Implementation details
First I tried to use HTML elements to do so (
multiple
attribute onselect
in particular) however I found it really bad as you have to maintain ctrl (or cmd on mac) and click on multiple lines to be able to select more than one element, which isn't great.So since I couldn't find a native way to do this, I re-used the popover code we already have for the other menus. To prevent reloading every time you check/uncheck a box, I decided to add a "refresh" button instead which is disabled until you pick a different filtering selection.
You can give it a try here.
Unresolved questions
In case there are a lot of crates and you want to only pick one, you'll have to unselect all others, which is quite bad. I had the idea when you checked/unchecked a box to make a small button appear right below it for a few seconds which would allow to do that. Not sure if it's a good idea or not though.
Remaining to be done
Since this is a draft, this PR isn't complete, here are the missing parts:
overflow-y: auto
to prevent it taking too much height when you have too many crates.settings.css
content back intomain.css
(I plan to do this in any case as there isn't much point for this file to exist considering it contains very few CSS rules).What do you think about it?
cc @jsha
r? @notriddle