about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/search.js
AgeCommit message (Collapse)AuthorLines
2025-07-16Make aliases search support partial matchingGuillaume Gomez-73/+77
2025-06-26rustdoc js: several typechecking improvmentsbinarycat-64/+28
non-exhaustive list of changes: * rustdoc.Results has a max_dist field * improve typechecking around pathDist and addIntoResults * give handleNameSearch a type signature * typecheck sortQ * currentCrate is string and not optional * searchState is referenced as a global, not through window
2025-06-20Rollup merge of #142497 - GuillaumeGomez:fix-random-search-failure, ↵Trevor Gross-37/+41
r=lolbinarycat Fix random failure when JS code is executed when the whole file was not read yet Very randomly (and rarely), when I arrived on a page with `?search=something` in the URL, I got this error: ![Screenshot From 2025-06-14 11-27-46](https://github.com/user-attachments/assets/4b61b067-4e80-49c1-9a45-cff1509bf86a) Moving the `initSearch` function at the bottom to ensure everything has been loaded fixes the issue. PS: Sorry for the noise. Pushed to the wrong branch and https://github.com/rust-lang/rust/pull/142496 closed. ><
2025-06-17Lint about `console` calls in rustdoc JSGuillaume Gomez-0/+1
2025-06-16Add comment to prevent having code other than `initSearch` at the end of ↵Guillaume Gomez-0/+4
`search.js`
2025-06-14Fix random failure when JS code is executed when the whole file was not read yetGuillaume Gomez-37/+37
2025-03-27search.js: revert usage of nonundef for now (not available under test)binarycat-2/+3
specifically, `storage.js` is not loaded during `rustdoc-js` and `rustdoc-js-std` tests.
2025-03-26satisfy eslintbinarycat-3/+3
2025-03-24search.js: fix whitespacebinarycat-1/+1
2025-03-24search.js: give type annotation to newSolutionsbinarycat-2/+2
2025-03-24search.js: give type to unifiedGenericsMgensbinarycat-2/+1
2025-03-24search.js: fix return type of unifyFunctionTypesbinarycat-2/+1
2025-03-24search.js: use @type instead of @ts-expect-errorbinarycat-5/+1
2025-03-24search.js: fix signature of pushTextbinarycat-9/+5
2025-03-24search.js: refactor transformResultsbinarycat-12/+17
2025-03-24search.js: remove another Map.has() and @ts-expect-errorbinarycat-3/+3
2025-03-24search.js(query parser): rethrow error if it isn't a string arraybinarycat-3/+7
only errors that are string arrays are intended to be shown to the user, other errors are bugs, and will be shown in the console as usual.
2025-03-24search.js: add undef2null and eliminate more @ts-expect-errorbinarycat-10/+21
2025-03-24search.js: refactor handling of rawPaths in buildIndexbinarycat-20/+22
2025-03-24search.js: improve typechecking by avoiding Map.hasbinarycat-13/+8
2025-03-24rustdoc js: add nonundef and use it to remove a ts-expect-errorbinarycat-4/+3
2025-03-04search.js: remove incorrect outdated commentbinarycat-2/+0
2025-03-04search.js: give RawSearchIndexCrate.a an index signaturebinarycat-3/+1
2025-03-04search.js: allow empty result arraysbinarycat-4/+3
2025-03-04search.js: give buildIndex a proper return typebinarycat-1/+3
some of the fields of rustdoc.Row were confusing null and undefined.
2025-03-04search.js: give local `where` a typebinarycat-2/+1
2025-03-04give local mgens a typebinarycat-2/+1
2025-03-04search.js: give pathSplitter a type signaturebinarycat-1/+5
2025-03-04search.js: second argument of convertNameToId is optionalbinarycat-2/+1
2025-03-04search.js: local variable `extra` is an array, annotate it as such.binarycat-2/+2
2025-03-04don't use double quotesbinarycat-1/+1
2025-03-04fix whitespacebinarycat-6/+6
2025-03-04ParserQueryElement.typeFilter MAY be a string, OR number.binarycat-3/+1
ideally we would encode that it is a string before convertTypeFilterOnElem is called, and a number after, but i'm not sure that's possible without significant refactoring.
2025-03-04rustdoc search: give buildTypeMapIndex a conditional return typebinarycat-16/+10
we encode "if the argument is a non-empty string, this will never return null" into the type signature.
2025-03-03rustdoc search: increase strictness of typecheckingbinarycat-4/+3
2025-02-15rustdoc: Properly restore search input placeholderLeón Orell Valerian Liehr-2/+3
2025-02-05Rollup merge of #136263 - notriddle:notriddle/typescript2, r=fmeaseLeón Orell Valerian Liehr-2/+0
rustdoc: clean up a bunch of ts-expected-error declarations in main This mostly consists of handling potentially-null input and adding more global functions to the list of globals. Follow-up for #136161
2025-02-03rustdoc: clean up a bunch of ts-expected-error declarations in mainMichael Howell-2/+0
This mostly consists of handling potentially-null input and adding more global functions to the list of globals.
2025-01-30fix(rustdoc): always use a channel when linking to doc.rust-lang.orgAlexis (Poliorcetics) Bourget-4/+5
2025-01-27rustdoc: add nobuild typescript checking to our JSMichael Howell-337/+864
By nobuild, I mean that the type annotations are all in comments, not in the "native" typescript syntax. This is a bit uglier, but it lets you rapid-prototype without tsc, works with all the native browser debugging tools, and keeps Node out of Rust's bootstrap chain. This pull request mostly just adds ts-ignore annotations and type declarations. To actually take good advantage of typescript, we'll want to "burn down" this pile of unsafe code until we eventually have a version with almost none of these. This PR also adds tsc to the mingw-check Dockerfile, so that it can't fall out of date like the Closure annotations did. https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/typescript
2025-01-16Treat other items as functions for the purpose of type-based searchbinarycat-0/+16
constants and statics are nullary functions, and struct fields are unary functions. functions (along with methods and trait methods) are prioritized over other items, like fields and constants.
2025-01-13for purely return-type based searches, deprioritize clone-like functionsbinarycat-0/+46
A clone-like function in a function that takes as an argument the type that it returns. However, functions that return a type variable are not counted as clone-line. Because we're not unifying the whole function at once, a function like `U -> T` would otherwise be counted as "clone-like" because the generics will just unify with anything when done seperatly. Co-authored-by: Michael Howell <michael@notriddle.com>
2024-12-31Fix typosericlehong-2/+2
Signed-off-by: ericlehong <193237094+ericlehong@users.noreply.github.com>
2024-12-13rustdoc-search: show `impl Trait` inline when unhighlightedMichael Howell-1/+6
While normal generics can be skipped in this case, no-names need something to show here. Before: `TyCtxt, , Symbol -> bool` After: `TyCtxt, Into<DefId>, Symbol -> bool`
2024-11-18rustdoc-search: add descriptive comments to bitmap classMichael Howell-0/+23
2024-11-18rustdoc-search: use smart binary search in bitmapsMichael Howell-10/+32
Addresses a comment from [jsha's benchmarking], where the `contains` function showed up in the profiler. This commit pulls it from about 5% of the runtime to about 0.5%. [jsha's benchmarking]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/search.20profiling/near/481868761
2024-11-15rustdoc search: allow queries to end in an empty path segmentbinarycat-5/+15
fixes https://github.com/rust-lang/rust/issues/129707 this can be used to show all items in a module, or all associated items for a type. currently sufferes slightly due to case insensitivity, so `Option::` will also show items in the `option::` module. it disables the checking of the last path element, otherwise only items with short names will be shown
2024-11-14Auto merge of #133047 - matthiaskrgr:rollup-9se1vth, r=matthiaskrgrbors-4/+7
Rollup of 4 pull requests Successful merges: - #128197 (Skip locking span interner for some syntax context checks) - #133040 ([rustdoc] Fix handling of footnote reference in footnote definition) - #133043 (rustdoc-search: case-sensitive only when capitals are used) - #133046 (Clippy subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-14rustdoc-search: case-sensitive only when capitals are usedMichael Howell-4/+7
This is the "smartcase" behavior, described by vim and dtolnay.
2024-11-13Add descriptive comment for NameTrieMichael Howell-0/+19