Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant: Show a better error when `/docs` is used without a package name (#16157)

Marshall Bowerscade9fbd3dd9
diff --git a/crates/assistant/src/slash_command/docs_command.rs b/crates/assistant/src/slash_command/docs_command.rs
index 075542f7452..8a528249bb8 100644
--- a/crates/assistant/src/slash_command/docs_command.rs
+++ b/crates/assistant/src/slash_command/docs_command.rs
@@ -276,6 +276,15 @@ impl SlashCommand for DocsSlashCommand {
} => (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?;
if let Some(package) = args.package() {