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.

Don't include prompt titles / "Default Prompt:" in slash command output (#13139)

Antonio Scandurra78091fa91ee5
diff --git a/crates/assistant/src/slash_command/default_command.rs b/crates/assistant/src/slash_command/default_command.rs
index 56c3a449979..bd26b724c94 100644
--- a/crates/assistant/src/slash_command/default_command.rs
+++ b/crates/assistant/src/slash_command/default_command.rs
@@ -53,7 +53,7 @@ impl SlashCommand for DefaultSlashCommand {
let prompts = store.default_prompt_metadata();
let mut text = String::new();
- writeln!(text, "Default Prompt:").unwrap();
+ text.push('\n');
for prompt in prompts {
if let Some(title) = prompt.title {
writeln!(text, "/prompt {}", title).unwrap();
@@ -61,6 +61,10 @@ impl SlashCommand for DefaultSlashCommand {
}
text.pop();
+ if text.is_empty() {
+ text.push('\n');
+ }
+
Ok(SlashCommandOutput {
sections: vec![SlashCommandOutputSection {
range: 0..text.len(),
diff --git a/crates/assistant/src/slash_command/prompt_command.rs b/crates/assistant/src/slash_command/prompt_command.rs
index 3e3041e1700..21e22fd8372 100644
--- a/crates/assistant/src/slash_command/prompt_command.rs
+++ b/crates/assistant/src/slash_command/prompt_command.rs
@@ -69,7 +69,10 @@ impl SlashCommand for PromptSlashCommand {
}
});
cx.foreground_executor().spawn(async move {
- let prompt = prompt.await?;
+ let mut prompt = prompt.await?;
+ if prompt.is_empty() {
+ prompt.push('\n');
+ }
let range = 0..prompt.len();
Ok(SlashCommandOutput {
text: prompt,