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: Fix nested slash command rendering (#16173)

Piotr Osiewicz7eeb37262aa5
diff --git a/crates/assistant/src/slash_command/prompt_command.rs b/crates/assistant/src/slash_command/prompt_command.rs
index 1b2769add8a..0eba5a6dc1f 100644
--- a/crates/assistant/src/slash_command/prompt_command.rs
+++ b/crates/assistant/src/slash_command/prompt_command.rs
@@ -77,6 +77,11 @@ impl SlashCommand for PromptSlashCommand {
});
cx.foreground_executor().spawn(async move {
let mut prompt = prompt.await?;
+
+ if prompt.starts_with('/') {
+ // Prevent an edge case where the inserted prompt starts with a slash command (that leads to funky rendering).
+ prompt.insert(0, '\n');
+ }
if prompt.is_empty() {
prompt.push('\n');
}