mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-09 21:26:14 +03:00
assistant: Show an error when /fetch
returns no content (#16001)
This PR makes it so the `/fetch` slash command will display an error when the URL does not have any textual content: <img width="308" alt="Screenshot 2024-08-08 at 4 51 55 PM" src="https://github.com/user-attachments/assets/bf4cbc18-c65b-48a2-aedd-26b50f47f018"> Release Notes: - N/A
This commit is contained in:
parent
5b8ce91048
commit
2bc503771b
@ -150,6 +150,10 @@ impl SlashCommand for FetchSlashCommand {
|
|||||||
let url = SharedString::from(url);
|
let url = SharedString::from(url);
|
||||||
cx.foreground_executor().spawn(async move {
|
cx.foreground_executor().spawn(async move {
|
||||||
let text = text.await?;
|
let text = text.await?;
|
||||||
|
if text.trim().is_empty() {
|
||||||
|
bail!("no textual content found");
|
||||||
|
}
|
||||||
|
|
||||||
let range = 0..text.len();
|
let range = 0..text.len();
|
||||||
Ok(SlashCommandOutput {
|
Ok(SlashCommandOutput {
|
||||||
text,
|
text,
|
||||||
|
Loading…
Reference in New Issue
Block a user