Skip to content

rustdoc: feature request directly go to item on exact match #84214

@TrAyZeN

Description

@TrAyZeN

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

image

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.

image

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.

Activity

jyn514

jyn514 commented on Apr 15, 2021

@jyn514
Member

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.

added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
on Apr 15, 2021
PatchMixolydic

PatchMixolydic commented on Apr 15, 2021

@PatchMixolydic
Contributor

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 to std::ffi::OsStr).

jyn514

jyn514 commented on Apr 15, 2021

@jyn514
Member

(ex. searching for std::ffi::OsString would take you to std::ffi::OsStr).

I don't see why that's true? OsString is not an exact match for OsStr.

0xPoe

0xPoe commented on Apr 15, 2021

@0xPoe
Member

@rustbot claim

0xPoe

0xPoe commented on Apr 15, 2021

@0xPoe
Member

I would like to try it.

PatchMixolydic

PatchMixolydic commented on Apr 15, 2021

@PatchMixolydic
Contributor

(ex. searching for std::ffi::OsString would take you to std::ffi::OsStr).

I don't see why that's true? OsString is not an exact match for OsStr.

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 to OsStr's docs before they can press the key.

jyn514

jyn514 commented on Apr 15, 2021

@jyn514
Member

Oh I see - we could increase the delay for sending you to an exact match to something like a couple seconds.

the8472

the8472 commented on Apr 16, 2021

@the8472
Member

How about going to the first result when hitting the return key?

jyn514

jyn514 commented on Apr 16, 2021

@jyn514
Member

How about going to the first result when hitting the return key?

Sure, that also seems useful, right now enter does nothing immediately after a search. I think we can do both :)

TrAyZeN

TrAyZeN commented on Apr 16, 2021

@TrAyZeN
Author

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 to std::ffi::OsStr).

I did not think about that issue but what @the8472 proposed sounds good to me.

21 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-rustdoc-searchArea: Rustdoc's search featureC-enhancementCategory: 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.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @jsha@the8472@Manishearth@jeanlucthumm@PatchMixolydic

    Issue actions

      rustdoc: feature request directly go to item on exact match · Issue #84214 · rust-lang/rust