-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-rustdoc-searchArea: Rustdoc's search featureArea: Rustdoc's search featureC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
Problem
Hello, we already have an option Directly go to item in search if there is only one result which can be enabled in the settings
However, when typing an item path we have a lot of results that shows up and so we can rarely get redirected with the previous option.
Solution
I think that it could be useful to have a feature Directly go to item on exact match.
- This feature would be an option which can be enabled in the settings (so we still let users to choose what they prefer).
- As the name suggests it would redirected to the item documentation when typing the exact path.
For instance, on the previous screenshot when typing std::vec::Vec
it would redirect to the item page.
Metadata
Metadata
Assignees
Labels
A-rustdoc-searchArea: Rustdoc's search featureArea: Rustdoc's search featureC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
jyn514 commentedon Apr 15, 2021
Rather than adding a new option, I would change the existing option to take you to the page if there's only one match or there's an exact match.
PatchMixolydic commentedon Apr 15, 2021
If I'm reading this correctly, redirecting on an exact match when there's more than one result could be problematic if one type's name is the prefix of another (ex. searching for
std::ffi::OsString
would take you tostd::ffi::OsStr
).jyn514 commentedon Apr 15, 2021
I don't see why that's true? OsString is not an exact match for OsStr.
0xPoe commentedon Apr 15, 2021
@rustbot claim
0xPoe commentedon Apr 15, 2021
I would like to try it.
PatchMixolydic commentedon Apr 15, 2021
This could be problematic for slow typers due to Rustdoc's incremental search feature. I may be misunderstanding how this feature will work, but if I'm not, then the problem is as follows: the user may type out
std::ffi::OsSt
, press 'r', then move to press 'i', but then get redirected toOsStr
's docs before they can press the key.jyn514 commentedon Apr 15, 2021
Oh I see - we could increase the delay for sending you to an exact match to something like a couple seconds.
the8472 commentedon Apr 16, 2021
How about going to the first result when hitting the return key?
jyn514 commentedon Apr 16, 2021
Sure, that also seems useful, right now enter does nothing immediately after a search. I think we can do both :)
TrAyZeN commentedon Apr 16, 2021
I did not think about that issue but what @the8472 proposed sounds good to me.
21 remaining items