You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustdoc: search should prioritize matching capitalization #119480
It's good that rustdoc's search is case-insensitive, to make it easier for people to find what they're looking for. However, if the user types in capitalization that exactly matches (or more closely matches) a given type, rustdoc's search results should prioritize that type over things that don't match in case.
It might also make sense to make this based on whether there were capital letters in the user's input. Vim has a similar feature that can be enabled, where searching with all lowercase is case-insensitive, but mixed-case is sensitive. In rustdoc's case, we could do something similar, except make it case-preferenced rather than exclude non-matching capitalization altogether.
The Vim style is smartcase (ripgrep has a --smart-case flag), which matches case insensitive unless there are any uppercase characters, in which case it does a case-sensitive match.
However, that is better for when you have binary results (either it matches or it doesn't), giving precedence to exact-case matches is better when you can rank the results. This is what e.g. https://github.com/kentcdodds/match-sorter does.
(I would have liked this for adding a PATH alias in #119748)
Activity
camelid commentedon Jan 8, 2024
It might also make sense to make this based on whether there were capital letters in the user's input. Vim has a similar feature that can be enabled, where searching with all lowercase is case-insensitive, but mixed-case is sensitive. In rustdoc's case, we could do something similar, except make it case-preferenced rather than exclude non-matching capitalization altogether.
tgross35 commentedon Feb 28, 2024
The Vim style is smartcase (ripgrep has a
--smart-caseflag), which matches case insensitive unless there are any uppercase characters, in which case it does a case-sensitive match.However, that is better for when you have binary results (either it matches or it doesn't), giving precedence to exact-case matches is better when you can rank the results. This is what e.g. https://github.com/kentcdodds/match-sorter does.
(I would have liked this for adding a PATH alias in #119748)
lolbinarycat commentedon Aug 22, 2024
@rustbot claim
rustdoc: show exact case-sensitive matches first
rustdoc: show exact case-sensitive matches first
rustdoc: show exact case-sensitive matches first
rustdoc: show exact case-sensitive matches first
rustdoc: show exact case-sensitive matches first
Rollup merge of rust-lang#129430 - lolbinarycat:rustdoc-search-exact-…
Rollup merge of rust-lang#129430 - lolbinarycat:rustdoc-search-exact-…
Rollup merge of rust-lang#129430 - lolbinarycat:rustdoc-search-exact-…
Rollup merge of rust-lang#129430 - lolbinarycat:rustdoc-search-exact-…
Rollup merge of rust-lang#129430 - lolbinarycat:rustdoc-search-exact-…
Rollup merge of rust-lang#129430 - lolbinarycat:rustdoc-search-exact-…
Unrolled build for rust-lang#129430
lolbinarycat commentedon Sep 3, 2024
reopening this because it's only fixed in the simplest case, if you use a full path it will not be fixed.