Skip to content
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

Shorthand for searching? #1381

Closed
matthiasbeyer opened this issue Apr 28, 2021 · 8 comments
Closed

Shorthand for searching? #1381

matthiasbeyer opened this issue Apr 28, 2021 · 8 comments

Comments

@matthiasbeyer
Copy link

Hi,

it would be nice to have a shorthand for searching, E.G.:

docs.rs/clap/App

To search for "App" in the docs for the clap crate. Most of the times I know which type I want to look at, so this would reduce my search-time by 50% (two page loads -> one page load).

Would such a thing be feasible?

@Nemo157
Copy link
Member

Nemo157 commented Apr 28, 2021

docs.rs/clap?search=App works already to go directly to the search results. There is rust-lang/rust#84214 which would make docs.rs/clap?search=clap::App go directly to the type, though it'd still be two page loads since the search is client-side.

@matthiasbeyer
Copy link
Author

Yeah that's just really long to type 😄

@Nemo157
Copy link
Member

Nemo157 commented Apr 28, 2021

To specifically help with that rustdoc could support bare searches in the query, docs.rs/clap?App (are there any non-search parameters that rustdoc supports now?)

It is also sorta plausible that docs.rs could parse the search-index server-side and do some form of "I'm feeling lucky" redirect to avoid the double page load; but that'd require making the search-index format stable, so that rustdoc doesn't change it under us in the future.

@jyn514
Copy link
Member

jyn514 commented Apr 28, 2021

I don't think docs.rs/clap?App is a good approach, that means adding any query parameter ever will be a breaking change. I would be ok with /clap/App since version numbers and identifiers can't overlap, but it might be tricky to implement.

@jyn514
Copy link
Member

jyn514 commented Apr 28, 2021

Also I'm confused by the rationale - search is all client side so this won't affect load times whatsoever.

@matthiasbeyer
Copy link
Author

search is all client side so this won't affect load times whatsoever.

Yeah, I misphrased a bit: It's not the load times as in "browser loading" but as in "brain loading" that I mean. Right now, the workflow is <Ctrl-T>docs.rs/clap<Enter>SApp<Enter>, after that it would be <Ctrl-T>docs.rs/clap/App<Enter>, which is way shorter and less resource intensive on my brain, as I can keep the current Code I'm working on in memory! 😆

@Nemo157
Copy link
Member

Nemo157 commented Apr 28, 2021

I don't think docs.rs/clap?App is a good approach, that means adding any query parameter ever will be a breaking change.

Sure, but is there actually any reason to ever add a new query parameter? It wouldn't actually be a breaking change if only a query-string without = is treated as a search parameter, a new query parameter with empty value would be docs.rs/clap?app=.

@syphar
Copy link
Member

syphar commented Jan 11, 2023

This is solved since (october?) last year,

one can now use https://docs.rs/clap::App to end up in the search for App in the clap docs.

@syphar syphar closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants