assistant: Fix terminal inline assistant not showing retry on error (#17651)

Release Notes:

- Fixed an issue where a failed inline assistant prompt could not be
restarted
This commit is contained in:
Bennet Bo Fenner 2024-09-10 11:45:21 -04:00 committed by GitHub
parent a7ac37156c
commit d5498c52f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -465,7 +465,8 @@ impl EventEmitter<PromptEditorEvent> for PromptEditor {}
impl Render for PromptEditor {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
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)
@ -516,7 +517,8 @@ impl Render for PromptEditor {
.tooltip(|cx| Tooltip::for_action("Cancel Assist", &menu::Cancel, cx))
.on_click(cx.listener(|_, _, cx| cx.emit(PromptEditorEvent::CancelRequested)));
if self.edited_since_done {
let has_error = matches!(status, CodegenStatus::Error(_));
if has_error || self.edited_since_done {
vec![
cancel,
IconButton::new("restart", IconName::RotateCw)