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.

Inline Assist: replace "accept" action on generation error with "restart" (#15476)

Piotr Osiewicz21ebbc387a06
diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs
index bedd7e610f6..87bccee8ea6 100644
--- a/crates/assistant/src/inline_assistant.rs
+++ b/crates/assistant/src/inline_assistant.rs
@@ -1219,7 +1219,8 @@ impl EventEmitter<PromptEditorEvent> for PromptEditor {}
impl Render for PromptEditor {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let gutter_dimensions = *self.gutter_dimensions.lock();
- let buttons = match &self.codegen.read(cx).status {
+ let status = &self.codegen.read(cx).status;
+ let buttons = match status {
CodegenStatus::Idle => {
vec![
IconButton::new("cancel", IconName::Close)
@@ -1272,7 +1273,7 @@ impl Render for PromptEditor {
.on_click(
cx.listener(|_, _, cx| cx.emit(PromptEditorEvent::CancelRequested)),
),
- if self.edited_since_done {
+ if self.edited_since_done || matches!(status, CodegenStatus::Error(_)) {
IconButton::new("restart", IconName::RotateCw)
.icon_color(Color::Info)
.shape(IconButtonShape::Square)