Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
assistant: Normalize line endings for prompts loaded from the prompt library (#15708)
Marshall Bowers91bbf0efc443
diff --git a/crates/assistant/Cargo.toml b/crates/assistant/Cargo.tomlindex e5f769ede05..605867820f4 100644--- a/crates/assistant/Cargo.toml+++ b/crates/assistant/Cargo.toml@@ -71,6 +71,7 @@ strsim.workspace = truetelemetry_events.workspace = trueterminal.workspace = trueterminal_view.workspace = true+text.workspace = truetheme.workspace = truetoml.workspace = trueui.workspace = truediff --git a/crates/assistant/src/prompt_library.rs b/crates/assistant/src/prompt_library.rsindex 769db542252..965a8e3af6d 100644--- a/crates/assistant/src/prompt_library.rs+++ b/crates/assistant/src/prompt_library.rs@@ -36,6 +36,7 @@ use std::{sync::{atomic::AtomicBool, Arc},time::Duration,};+use text::LineEnding;use theme::ThemeSettings;use ui::{div, prelude::*, IconButtonShape, ListItem, ListItemSpacing, ParentElement, Render,@@ -1302,10 +1303,12 @@ impl PromptStore {let bodies = self.bodies;self.executor.spawn(async move {let txn = env.read_txn()?;- Ok(bodies+ let mut prompt = bodies.get(&txn, &id)?.ok_or_else(|| anyhow!("prompt not found"))?- .into())+ .into();+ LineEnding::normalize(&mut prompt);+ Ok(prompt)})}diff --git a/crates/assistant_slash_command/src/assistant_slash_command.rs b/crates/assistant_slash_command/src/assistant_slash_command.rsindex b33c2ce50b4..72836dd4b6f 100644--- a/crates/assistant_slash_command/src/assistant_slash_command.rs+++ b/crates/assistant_slash_command/src/assistant_slash_command.rs@@ -60,7 +60,7 @@ pub type RenderFoldPlaceholder = Arc<+ Fn(ElementId, Arc<dyn Fn(&mut WindowContext)>, &mut WindowContext) -> AnyElement,>;-#[derive(Default)]+#[derive(Debug, Default)]pub struct SlashCommandOutput {pub text: String,pub sections: Vec<SlashCommandOutputSection<usize>>,