This PR fixes an issue where crate names that included `-`s would not
work properly when indexing them with rustdoc, due to the output
directories using `_` instead of `-`.
Release Notes:
- N/A
This PR promotes package suggestions to a first-class concept on the
`IndexedDocsProvider` trait.
This will allow any implementer of `IndexedDocsProvider` to provide a
list of package names to suggest for use with `/docs`.
For the docs.rs provider we use the 250 most popular Rust crates (as
identified [here](https://lib.rs/std)), and for the rustdoc provider we
use the packages in the Cargo workspace.
Release Notes:
- N/A
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 PR updates the `/docs` slash command with the ability to
just-in-time index a package when there are not yet any results in the
index.
When running a `/docs` slash command, we fist check to see if there are
any results in the index that would match the search.
If there are, we go ahead and return them, as we do today.
However, if there are not yet any results we kick off an indexing task
as part of the command execution to fetch the results.
Release Notes:
- N/A
This PR updates the `/docs` slash command with basic globbing support
for expanding docs.
A `*` can be added to the item path to signify the end of a prefix
match.
For example:
```
# This will match any documentation items starting with `auk::`.
# In this case, it will pull in the docs for each item in the crate.
/docs docs-rs auk::*
# This will match any documentation items starting with `auk::visitor::`,
# which will pull in docs for the `visitor` module.
/docs docs-rs auk::visitor::*
```
https://github.com/user-attachments/assets/5e1e21f1-241b-483f-9cd1-facc3aa76365
Release Notes:
- N/A
This PR improves the error message shown by the `/docs` slash command
when indexing fails due to the absence of `target/doc`.
We now distinguish between the overall `target/doc` directory missing
and an individual crate directory missing beneath it.
Release Notes:
- N/A
This PR updates the `/docs` slash command to show a warning to the user
if a crate's docs cannot be indexed due to the target directory not
containing docs:
<img width="782" alt="Screenshot 2024-07-11 at 5 11 46 PM"
src="https://github.com/user-attachments/assets/2f54f7a1-97f4-4d2d-b51f-57ba31e50a2f">
Release Notes:
- N/A
This PR adds a new `/docs` slash command to the Assistant. This slash
command replaces `/rustdoc`.
The `/docs` slash command works with different providers. There is
currently a built-in provider for rustdoc, but new providers can be
defined within extensions. The Gleam extension contains an example of
this.
When you first type `/docs` a completion menu will be shown with the
list of available providers:
https://github.com/zed-industries/zed/assets/1486634/32287000-5855-44d9-a2eb-569596f5abd9
After completing the provider you want to use then you can type the
package name and/or item path to search for the relevant docs:
https://github.com/zed-industries/zed/assets/1486634/6fc55a63-7fcd-42ea-80ce-08c670bf03fc
There are still some rough edges around completions that I would like to
get cleaned up in a future PR. Both of these seem to stem from the fact
that we're using an intermediate completion in the slash command:
1. Accepting a provider completion will show an error until you press
<kbd>Space</kbd> to continue typing.
- We need a way of not submitting a slash command when a completion is
accepted.
2. We currently need to show the provider name in the documentation item
completion list.
- Without it, the provider name gets wiped out when accepting a
completion, causing the slash command to become invalid.
Release Notes:
- N/A
This PR begins the process of making the backing infrastructure for the
`/rustdoc` command more generic such that it can be applied to
additional documentation providers.
In this PR we:
- Rename the `rustdoc` crate to `indexed_docs` as a more general-purpose
name
- Start moving rustdoc-specific functionality into
`indexed_docs::providers::rustdoc`
- Add an `IndexedDocsRegistry` to hold multiple `IndexedDocsStore`s (one
per provider)
We haven't yet removed the rustdoc-specific bits in the `DocsIndexer`.
That will follow soon.
Release Notes:
- N/A