Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add disabled style for prompt editor after confirming
Antonio Scandurra55bf45d26572
diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rsindex c5bf027fcc9..f7abcdf748a 100644--- a/crates/ai/src/assistant.rs+++ b/crates/ai/src/assistant.rs@@ -2871,8 +2871,15 @@ impl InlineAssistant {cx.emit(InlineAssistantEvent::Dismissed);} else {let prompt = self.prompt_editor.read(cx).text(cx);- self.prompt_editor- .update(cx, |editor, _| editor.set_read_only(true));+ self.prompt_editor.update(cx, |editor, cx| {+ editor.set_read_only(true);+ editor.set_field_editor_style(+ Some(Arc::new(|theme| {+ theme.assistant.inline.disabled_editor.clone()+ })),+ cx,+ );+ });cx.emit(InlineAssistantEvent::Confirmed { prompt });self.confirmed = true;}diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex d5141a7f7df..75fb6006c0d 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -1606,6 +1606,15 @@ impl Editor {self.read_only = read_only;}+ pub fn set_field_editor_style(+ &mut self,+ style: Option<Arc<GetFieldEditorTheme>>,+ cx: &mut ViewContext<Self>,+ ) {+ self.get_field_editor_theme = style;+ cx.notify();+ }+pub fn replica_id_map(&self) -> Option<&HashMap<ReplicaId, ReplicaId>> {self.replica_id_mapping.as_ref()}diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rsindex bc0c98bac70..7913685b7a5 100644--- a/crates/theme/src/theme.rs+++ b/crates/theme/src/theme.rs@@ -1158,6 +1158,7 @@ pub struct InlineAssistantStyle {#[serde(flatten)]pub container: ContainerStyle,pub editor: FieldEditor,+ pub disabled_editor: FieldEditor,pub pending_edit_background: Color,}diff --git a/styles/src/style_tree/assistant.ts b/styles/src/style_tree/assistant.tsindex bdca8a16e56..8bef2ce16b4 100644--- a/styles/src/style_tree/assistant.ts+++ b/styles/src/style_tree/assistant.ts@@ -68,9 +68,17 @@ export default function assistant(): any {}),editor: {text: text(theme.highest, "mono", "default", { size: "sm" }),- placeholder_text: text(theme.lowest, "sans", "on", "disabled"),+ placeholder_text: text(theme.highest, "sans", "on", "disabled"),selection: theme.players[0],},+ disabled_editor: {+ text: text(theme.highest, "mono", "disabled", { size: "sm" }),+ placeholder_text: text(theme.highest, "sans", "on", "disabled"),+ selection: {+ cursor: text(theme.highest, "mono", "disabled").color,+ selection: theme.players[0].selection,+ },+ },pending_edit_background: background(theme.highest, "positive"),},message_header: {