rustdoc: Automatically index crates (#13014)

This PR removes the need to use `/rustdoc --index <CRATE_NAME>` and
instead indexes the crates once they are referenced.

As soon as the first `:` is added after the crate name, the indexing
will kick off in the background and update the index as it goes.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-13 18:30:15 -04:00 committed by GitHub
parent e0c1ab650e
commit 86167138a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 70 additions and 102 deletions

View file

@ -56,8 +56,6 @@ impl RustdocProvider for LocalProvider {
local_cargo_doc_path.push("index.html");
}
println!("Fetching {}", local_cargo_doc_path.display());
let Ok(contents) = self.fs.load(&local_cargo_doc_path).await else {
return Ok(None);
};
@ -91,8 +89,6 @@ impl RustdocProvider for DocsDotRsProvider {
.unwrap_or_default()
);
println!("Fetching {}", &format!("https://docs.rs/{path}"));
let mut response = self
.http_client
.get(
@ -165,8 +161,6 @@ impl RustdocIndexer {
while let Some(item_with_history) = items_to_visit.pop_front() {
let item = &item_with_history.item;
println!("Visiting {:?} {:?} {}", &item.kind, &item.path, &item.name);
let Some(result) = self
.provider
.fetch_page(&crate_name, Some(&item))