-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: show type signature on type-driven SERP #117112
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
e09dd6e
to
8e043ab
Compare
This comment has been minimized.
This comment has been minimized.
8e043ab
to
22619c9
Compare
This comment has been minimized.
This comment has been minimized.
22619c9
to
952e01e
Compare
This comment has been minimized.
This comment has been minimized.
952e01e
to
f5654ea
Compare
This comment has been minimized.
This comment has been minimized.
9a9f7a9
to
c3a08be
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9fda9c9
to
a550f11
Compare
This comment has been minimized.
This comment has been minimized.
a550f11
to
35bddbb
Compare
This comment has been minimized.
This comment has been minimized.
35bddbb
to
8337170
Compare
This is really an awesome idea! Code looks good to me as well, nothing to say except: great job! |
This reduces code size while still matching the common case for plain, concrete types.
This displays the function signature, as rustdoc understands it, on the In Parameters, In Return Types, and In Function Signature pages, but not in the In Names page, since it's not used there. It also highlights the matching parts, to clarify why a function is considered a good match.
8337170
to
42616b3
Compare
This cleans up the Simd page. It should be sufficient, even though it can wind up showing more than necessary, but allows each item to be considered in isolation.
42616b3
to
a463f43
Compare
☔ The latest upstream changes (presumably #117955) made this pull request unmergeable. Please resolve the merge conflicts. |
This is a really great UI improvement, and I'd quite like to see it landed. I'm not qualified to review the implementation, but design wise, a couple of things:
|
That's one major reason why this is still a draft. Everything it shows should be searchable, but the search index doesn't contain references and it can't parse them, Once the search engine can parse and search for most type expressions, including
I need to communicate that the Instead of just using |
This PR is going to need to be mostly rewritten, because it mutates the function signature AST in-place, but #119756 causes chunks of that tree to be reused across functions. It should treat the AST as read-only and construct another data structure for highlighting. Thanks for pointing out the Notice how, in the above screenshot, "build" is highlighted even though the actual query says "compiled." Additional information about a result should probably go in a popover (the below screenshot is the right idea, but not nearly detailed enough for our use case): Pulling this off is going to require stashing the definition-side names of generic type parameters somewhere (as well as implementing a popover with all the "why this result" information in it). |
Preview
Screenshots of what these pages looked like before
Preview page:
Desktop screenshots:
Mobile screenshot:
Description
This displays the function signature, as rustdoc understands it, on the In Parameters, In Return Types, and In Function Signature pages, but not in the In Names page, since it's not used there. It also highlights the matching parts, to clarify why a function is considered a good match.
Rationale
Since the point of this feature is to answer the question "why this a match," it's important that it communicates a few things:
T
andU
both got matched even though this particular result is a bit counterintuitive).This change also allows us to stop de-duplicating these results, so it's a follow-up for #109422 (comment). This PR doesn't remove the deduplication logic for the name-based search, because it seems like showing all of the Simd add functions in that context would be more annoying than useful, because it could push the result that you want off the screen, and there's no way to narrow down to a particular one without switching to an entirely different style of search.
Future possibilities
This needs merged with #116085. This branch is not currently based on that one.
Other future possibilities, copied directly from there:
This system has no ranking algorithm. We should fix that.The unification algorithm is complex and slow. Smart data structures, like bloom filters, can help.()
#118194