mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 22:34:13 +00:00
assistant: Show a better error when /docs
is used without a package name (#16157)
This PR makes it so that running `/docs` without providing a package name gives a better error message: <img width="248" alt="Screenshot 2024-08-13 at 9 24 58 AM" src="https://github.com/user-attachments/assets/c1cc794e-0fa0-490a-871a-a56702b03d42"> <img width="228" alt="Screenshot 2024-08-13 at 9 25 05 AM" src="https://github.com/user-attachments/assets/45dca2d7-171f-48f0-a03c-254b552cb50d"> Release Notes: - N/A
This commit is contained in:
parent
fe190359d5
commit
cade9fbd3d
1 changed files with 9 additions and 0 deletions
|
@ -276,6 +276,15 @@ impl SlashCommand for DocsSlashCommand {
|
||||||
} => (provider, item_path),
|
} => (provider, item_path),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if key.trim().is_empty() {
|
||||||
|
let package_term = match provider.as_ref() {
|
||||||
|
"docs-rs" | "rustdoc" => "crate",
|
||||||
|
_ => "package",
|
||||||
|
};
|
||||||
|
|
||||||
|
bail!("no {package_term} name provided");
|
||||||
|
}
|
||||||
|
|
||||||
let store = store?;
|
let store = store?;
|
||||||
|
|
||||||
if let Some(package) = args.package() {
|
if let Some(package) = args.package() {
|
||||||
|
|
Loading…
Reference in a new issue