Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
edit predictions: Make Zed bar at least as wide as menu (#24206)
Agus Zubiaga4f98157e6470
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex cad517599fe..a9469345322 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -5415,6 +5415,7 @@ impl Editor {#[allow(clippy::too_many_arguments)]fn render_edit_prediction_cursor_popover(&self,+ min_width: Pixels,max_width: Pixels,cursor_point: Point,line_layouts: &[LineWithInvisibles],@@ -5429,6 +5430,7 @@ impl Editor {return Some(h_flex().h(self.edit_prediction_cursor_popover_height())+ .min_w(min_width).flex_1().px_2().gap_3()@@ -5458,7 +5460,10 @@ impl Editor {let is_refreshing = provider.provider.is_refreshing(cx);fn pending_completion_container() -> Div {- h_flex().gap_3().child(Icon::new(IconName::ZedPredict))+ h_flex()+ .flex_1()+ .gap_3()+ .child(Icon::new(IconName::ZedPredict))}let completion = match &self.active_inline_completion {@@ -5509,13 +5514,13 @@ impl Editor {Some(h_flex().h(self.edit_prediction_cursor_popover_height())+ .min_w(min_width).max_w(max_width).flex_1().px_2().gap_3().elevation_2(cx).child(completion)- .child(div().w_full()).child(h_flex().border_l_1()@@ -5648,7 +5653,7 @@ impl Editor {Icon::new(IconName::ZedPredict).into_any_element()};- Some(h_flex().gap_3().child(left).child(preview))+ Some(h_flex().flex_1().gap_3().child(left).child(preview))}InlineCompletion::Move {@@ -5681,6 +5686,7 @@ impl Editor {Some(h_flex().gap_3()+ .flex_1().child(render_relative_row_jump("Jump ",cursor_point.row,diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex d81ad144155..7af416ba052 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -3241,11 +3241,15 @@ impl EditorElement {} else {None};+ let min_width = context_menu+ .as_ref()+ .map_or(px(0.), |(_, _, size)| size.width);let max_width = max_width_for_stable_x.max(context_menu.as_ref().map_or(px(0.), |(_, _, size)| size.width),);+let edit_prediction = if edit_prediction_popover_visible {let accept_keystroke: Option<Keystroke>;@@ -3299,6 +3303,7 @@ impl EditorElement {self.editor.update(cx, move |editor, cx| {let mut element = editor.render_edit_prediction_cursor_popover(+ min_width,max_width,cursor_point,&line_layouts,