assistant: Auto-suggest crates for /docs when using the docs.rs provider (#16169)

This PR improves the initial experience of using `/docs docs-rs` with an
empty index.

We now show a brief explainer of what is expected (a crate name) as well
as list some popular Rust crates to try:

<img width="540" alt="Screenshot 2024-08-13 at 12 25 39 PM"
src="https://github.com/user-attachments/assets/942de250-2901-45df-9e3e-52ff3b3fc517">

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-08-13 12:37:13 -04:00 committed by GitHub
parent 03796e79b0
commit e3b0de5dda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 63 additions and 6 deletions

View file

@ -98,6 +98,26 @@ pub struct DocsDotRsProvider {
}
impl DocsDotRsProvider {
/// The list of crates to auto-suggest for the docs.rs provider when
/// the index is empty.
///
/// List has been chosen loosely based on [this list](https://lib.rs/std) of
/// popular Rust libraries.
///
/// Keep this alphabetized.
pub const AUTO_SUGGESTED_CRATES: &'static [&'static str] = &[
"anyhow",
"axum",
"chrono",
"itertools",
"rand",
"regex",
"serde",
"strum",
"thiserror",
"tokio",
];
pub fn id() -> ProviderId {
ProviderId("docs-rs".into())
}