From e7f64c7d98a289e0e6b11b86397ba90838738651 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 13:18:35 -0500 Subject: [PATCH] assistant_context_editor: Fix patch block not rendering due to window reborrow (cherry-pick #24461) (#24463) Cherry-picked assistant_context_editor: Fix patch block not rendering due to window reborrow (#24461) This PR fixes an issue where the Assistant patch block was not being rendered when using "Suggest Edits". The issue was that the `BlockContext` already has a borrow of the `Window`, so we can't use `update_in` to reborrow the window. The fix is to reuse the existing `&mut Window` reference from the `BlockContext` so we don't need to `update_in`. Closes #24169. Release Notes: - Assistant: Fixed an issue where the patch block was not being rendered when using "Suggest Edits". --------- Co-authored-by: Max Co-authored-by: Marshall Bowers Co-authored-by: Max --- crates/assistant_context_editor/src/context_editor.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/assistant_context_editor/src/context_editor.rs b/crates/assistant_context_editor/src/context_editor.rs index 86febdecc4dc6acb823a587ba3327e18e0d70aa4..f4509e1cf818b93d600eb5fee97db6c5585ddde2 100644 --- a/crates/assistant_context_editor/src/context_editor.rs +++ b/crates/assistant_context_editor/src/context_editor.rs @@ -832,12 +832,13 @@ impl ContextEditor { let render_block: RenderBlock = Arc::new({ let this = this.clone(); let patch_range = range.clone(); - move |cx: &mut BlockContext<'_, '_>| { + move |cx: &mut BlockContext| { let max_width = cx.max_width; let gutter_width = cx.gutter_dimensions.full_width(); let block_id = cx.block_id; let selected = cx.selected; - this.update_in(cx, |this, window, cx| { + let window = &mut cx.window; + this.update(cx.app, |this, cx| { this.render_patch_block( patch_range.clone(), max_width,