diff --git a/crates/collab2/src/tests/test_server.rs b/crates/collab2/src/tests/test_server.rs index cfecb4880d1c226daef22a9233568bdace832296..c486fa7943466614da48d05a7fd6c169037aade5 100644 --- a/crates/collab2/src/tests/test_server.rs +++ b/crates/collab2/src/tests/test_server.rs @@ -260,8 +260,6 @@ impl TestServer { .store(true, SeqCst); } - //todo!(workspace) - #[allow(dead_code)] pub fn simulate_long_connection_interruption( &self, peer_id: PeerId, diff --git a/crates/collab_ui2/src/face_pile.rs b/crates/collab_ui2/src/face_pile.rs index fd675127e4a0786da76f3f5eb044d836652f7fab..1c0d8100d85cd2eb3adb14fd59ffef8d092ecc0f 100644 --- a/crates/collab_ui2/src/face_pile.rs +++ b/crates/collab_ui2/src/face_pile.rs @@ -9,9 +9,9 @@ pub struct FacePile { } impl RenderOnce for FacePile { - type Rendered = Div; + type Output = Div; - fn render(self, _: &mut WindowContext) -> Self::Rendered { + fn render(self, _: &mut WindowContext) -> Self::Output { let player_count = self.faces.len(); let player_list = self.faces.into_iter().enumerate().map(|(ix, player)| { let isnt_last = ix < player_count - 1; diff --git a/crates/copilot2/src/copilot2.rs b/crates/copilot2/src/copilot2.rs index 4fd05a9c089bceaa038c0b4478102969a27656bc..4d4ed42620b1954cdf7c02d0414190ce511c3a2d 100644 --- a/crates/copilot2/src/copilot2.rs +++ b/crates/copilot2/src/copilot2.rs @@ -563,7 +563,6 @@ impl Copilot { } } - #[allow(dead_code)] // todo!() fn sign_out(&mut self, cx: &mut ModelContext) -> Task> { self.update_sign_in_status(request::SignInStatus::NotSignedIn, cx); if let CopilotServer::Running(RunningCopilotServer { lsp: server, .. }) = &self.server { @@ -1126,7 +1125,6 @@ mod tests { .update(cx, |copilot, cx| copilot.sign_out(cx)) .await .unwrap(); - // todo!() po: these notifications now happen in reverse order? assert_eq!( lsp.receive_notification::() .await, diff --git a/crates/editor2/src/element.rs b/crates/editor2/src/element.rs index eb9f4106ea43d57e5339511ad52b8255c6e35882..da7428a8e04e159c5c2f51b5905da182a0914c4b 100644 --- a/crates/editor2/src/element.rs +++ b/crates/editor2/src/element.rs @@ -2757,7 +2757,7 @@ enum Invisible { impl Element for EditorElement { type State = (); - fn layout( + fn request_layout( &mut self, _element_state: Option, cx: &mut gpui::WindowContext, diff --git a/crates/gpui2/src/element.rs b/crates/gpui2/src/element.rs index c8445cad06caeee291d388554878f28d996c67ed..bdb63d084ebbed6b569ad14ab6fbe519f0df4512 100644 --- a/crates/gpui2/src/element.rs +++ b/crates/gpui2/src/element.rs @@ -6,21 +6,42 @@ use derive_more::{Deref, DerefMut}; pub(crate) use smallvec::SmallVec; use std::{any::Any, fmt::Debug}; -pub trait Render: 'static + Sized { - fn render(&mut self, cx: &mut ViewContext) -> impl Element; +pub trait Element: 'static + IntoElement { + type State: 'static; + + fn request_layout( + &mut self, + state: Option, + cx: &mut WindowContext, + ) -> (LayoutId, Self::State); + + fn paint(&mut self, bounds: Bounds, state: &mut Self::State, cx: &mut WindowContext); + + fn into_any(self) -> AnyElement { + AnyElement::new(self) + } } +/// Implemented by any type that can be converted into an element. pub trait IntoElement: Sized { - type Element: Element + 'static; + /// The specific type of element into which the implementing type is converted. + type Element: Element; + /// The [ElementId] of self once converted into an [Element]. + /// If present, the resulting element's state will be carried across frames. fn element_id(&self) -> Option; + /// Convert self into a type that implements [Element]. fn into_element(self) -> Self::Element; + /// Convert self into a dynamically-typed [AnyElement]. fn into_any_element(self) -> AnyElement { self.into_element().into_any() } + /// Convert into an element, then draw in the current window at the given origin. + /// The provided available space is provided to the layout engine to determine the size of the root element. + /// Once the element is drawn, its associated element staet is yielded to the given callback. fn draw_and_update_state( self, origin: Point, @@ -52,6 +73,7 @@ pub trait IntoElement: Sized { } } + /// Convert self to another type by calling the given closure. Useful in rendering code. fn map(self, f: impl FnOnce(Self) -> U) -> U where Self: Sized, @@ -60,6 +82,7 @@ pub trait IntoElement: Sized { f(self) } + /// Conditionally chain onto self with the given closure. Useful in rendering code. fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self where Self: Sized, @@ -67,6 +90,8 @@ pub trait IntoElement: Sized { self.map(|this| if condition { then(this) } else { this }) } + /// Conditionally chain onto self with the given closure if the given option is Some. + /// The contents of the option are provided to the closure. fn when_some(self, option: Option, then: impl FnOnce(Self, T) -> Self) -> Self where Self: Sized, @@ -81,35 +106,46 @@ pub trait IntoElement: Sized { } } -pub trait Element: 'static + IntoElement { - type State: 'static; - - fn layout( - &mut self, - state: Option, - cx: &mut WindowContext, - ) -> (LayoutId, Self::State); +pub trait Render: 'static + Sized { + fn render(&mut self, cx: &mut ViewContext) -> impl Element; +} - fn paint(&mut self, bounds: Bounds, state: &mut Self::State, cx: &mut WindowContext); +/// You can derive [IntoElement] on any type that implements this trait. +/// It is used to allow views to be expressed in terms of abstract data. +pub trait RenderOnce: 'static { + type Output: IntoElement; - fn into_any(self) -> AnyElement { - AnyElement::new(self) - } + fn render(self, cx: &mut WindowContext) -> Self::Output; } -pub trait RenderOnce: 'static { - type Rendered: IntoElement; +pub trait ParentElement { + fn children_mut(&mut self) -> &mut SmallVec<[AnyElement; 2]>; - fn render(self, cx: &mut WindowContext) -> Self::Rendered; + fn child(mut self, child: impl IntoElement) -> Self + where + Self: Sized, + { + self.children_mut().push(child.into_element().into_any()); + self + } + + fn children(mut self, children: impl IntoIterator) -> Self + where + Self: Sized, + { + self.children_mut() + .extend(children.into_iter().map(|child| child.into_any_element())); + self + } } pub struct Component { component: Option, } -pub struct CompositeElementState { - rendered_element: Option<::Element>, - rendered_element_state: Option<<::Element as Element>::State>, +pub struct ComponentState { + rendered_element: Option<::Element>, + rendered_element_state: Option<<::Element as Element>::State>, } impl Component { @@ -121,9 +157,9 @@ impl Component { } impl Element for Component { - type State = CompositeElementState; + type State = ComponentState; - fn layout( + fn request_layout( &mut self, state: Option, cx: &mut WindowContext, @@ -131,16 +167,16 @@ impl Element for Component { let mut element = self.component.take().unwrap().render(cx).into_element(); if let Some(element_id) = element.element_id() { let layout_id = - cx.with_element_state(element_id, |state, cx| element.layout(state, cx)); - let state = CompositeElementState { + cx.with_element_state(element_id, |state, cx| element.request_layout(state, cx)); + let state = ComponentState { rendered_element: Some(element), rendered_element_state: None, }; (layout_id, state) } else { let (layout_id, state) = - element.layout(state.and_then(|s| s.rendered_element_state), cx); - let state = CompositeElementState { + element.request_layout(state.and_then(|s| s.rendered_element_state), cx); + let state = ComponentState { rendered_element: Some(element), rendered_element_state: Some(state), }; @@ -181,27 +217,6 @@ impl IntoElement for Component { #[derive(Deref, DerefMut, Default, Clone, Debug, Eq, PartialEq, Hash)] pub struct GlobalElementId(SmallVec<[ElementId; 32]>); -pub trait ParentElement { - fn children_mut(&mut self) -> &mut SmallVec<[AnyElement; 2]>; - - fn child(mut self, child: impl IntoElement) -> Self - where - Self: Sized, - { - self.children_mut().push(child.into_element().into_any()); - self - } - - fn children(mut self, children: impl IntoIterator) -> Self - where - Self: Sized, - { - self.children_mut() - .extend(children.into_iter().map(|child| child.into_any_element())); - self - } -} - trait ElementObject { fn element_id(&self) -> Option; @@ -256,15 +271,18 @@ impl DrawableElement { self.element.as_ref()?.element_id() } - fn layout(&mut self, cx: &mut WindowContext) -> LayoutId { + fn request_layout(&mut self, cx: &mut WindowContext) -> LayoutId { let (layout_id, frame_state) = if let Some(id) = self.element.as_ref().unwrap().element_id() { let layout_id = cx.with_element_state(id, |element_state, cx| { - self.element.as_mut().unwrap().layout(element_state, cx) + self.element + .as_mut() + .unwrap() + .request_layout(element_state, cx) }); (layout_id, None) } else { - let (layout_id, frame_state) = self.element.as_mut().unwrap().layout(None, cx); + let (layout_id, frame_state) = self.element.as_mut().unwrap().request_layout(None, cx); (layout_id, Some(frame_state)) }; @@ -323,7 +341,7 @@ impl DrawableElement { cx: &mut WindowContext, ) -> Size { if matches!(&self.phase, ElementDrawPhase::Start) { - self.layout(cx); + self.request_layout(cx); } let layout_id = match &mut self.phase { @@ -378,7 +396,7 @@ where } fn layout(&mut self, cx: &mut WindowContext) -> LayoutId { - DrawableElement::layout(self.as_mut().unwrap(), cx) + DrawableElement::request_layout(self.as_mut().unwrap(), cx) } fn paint(&mut self, cx: &mut WindowContext) { @@ -452,7 +470,7 @@ impl AnyElement { impl Element for AnyElement { type State = (); - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext, @@ -500,7 +518,7 @@ impl IntoElement for () { impl Element for () { type State = (); - fn layout( + fn request_layout( &mut self, _state: Option, cx: &mut WindowContext, diff --git a/crates/gpui2/src/elements/canvas.rs b/crates/gpui2/src/elements/canvas.rs index d04c65811fffeec45bc24b72c3d08a401c48eb52..767417ae40100a7ef3ff8ea6fecea0a4f9eca53f 100644 --- a/crates/gpui2/src/elements/canvas.rs +++ b/crates/gpui2/src/elements/canvas.rs @@ -29,7 +29,7 @@ impl IntoElement for Canvas { impl Element for Canvas { type State = Style; - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext, diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs index de6b185b670343d85348ebf38b7ef4b80a38465d..501ee712799ff26a77d1a2303bb5a1261dd815c0 100644 --- a/crates/gpui2/src/elements/div.rs +++ b/crates/gpui2/src/elements/div.rs @@ -765,7 +765,7 @@ impl ParentElement for Div { impl Element for Div { type State = DivState; - fn layout( + fn request_layout( &mut self, element_state: Option, cx: &mut WindowContext, @@ -1808,12 +1808,12 @@ where { type State = E::State; - fn layout( + fn request_layout( &mut self, state: Option, cx: &mut WindowContext, ) -> (LayoutId, Self::State) { - self.element.layout(state, cx) + self.element.request_layout(state, cx) } fn paint(&mut self, bounds: Bounds, state: &mut Self::State, cx: &mut WindowContext) { @@ -1882,12 +1882,12 @@ where { type State = E::State; - fn layout( + fn request_layout( &mut self, state: Option, cx: &mut WindowContext, ) -> (LayoutId, Self::State) { - self.element.layout(state, cx) + self.element.request_layout(state, cx) } fn paint(&mut self, bounds: Bounds, state: &mut Self::State, cx: &mut WindowContext) { diff --git a/crates/gpui2/src/elements/img.rs b/crates/gpui2/src/elements/img.rs index ab7b8d914094b677b647123074883611665d263b..650b5b666bc821e15873c53f2cdc56c0546b6a20 100644 --- a/crates/gpui2/src/elements/img.rs +++ b/crates/gpui2/src/elements/img.rs @@ -71,7 +71,7 @@ impl Img { impl Element for Img { type State = InteractiveElementState; - fn layout( + fn request_layout( &mut self, element_state: Option, cx: &mut WindowContext, diff --git a/crates/gpui2/src/elements/list.rs b/crates/gpui2/src/elements/list.rs index a0467aaaa3c92acd1b045a69bae3fb9658eb0f01..364b610eee761f8cd076c39aa1206c6d97016b0b 100644 --- a/crates/gpui2/src/elements/list.rs +++ b/crates/gpui2/src/elements/list.rs @@ -302,7 +302,7 @@ pub struct ListOffset { impl Element for List { type State = (); - fn layout( + fn request_layout( &mut self, _state: Option, cx: &mut crate::WindowContext, diff --git a/crates/gpui2/src/elements/overlay.rs b/crates/gpui2/src/elements/overlay.rs index 5b72019f177f899f886a375fe4468bcf403c336c..b5d8b53c7f613f92b966cd0afa025d636394b12e 100644 --- a/crates/gpui2/src/elements/overlay.rs +++ b/crates/gpui2/src/elements/overlay.rs @@ -60,7 +60,7 @@ impl ParentElement for Overlay { impl Element for Overlay { type State = OverlayState; - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext, diff --git a/crates/gpui2/src/elements/svg.rs b/crates/gpui2/src/elements/svg.rs index 9ca9baf470e6c3bdeec2fafb1806d34430c44aea..5ea7f9bd7825a0142fd38f07a8223ff3a973e9dc 100644 --- a/crates/gpui2/src/elements/svg.rs +++ b/crates/gpui2/src/elements/svg.rs @@ -26,7 +26,7 @@ impl Svg { impl Element for Svg { type State = InteractiveElementState; - fn layout( + fn request_layout( &mut self, element_state: Option, cx: &mut WindowContext, diff --git a/crates/gpui2/src/elements/text.rs b/crates/gpui2/src/elements/text.rs index e0444c2f0a0a99f4217f5adcb666259609b3dca6..834168f0b56d01e21e2508fc1993d765a5b5b321 100644 --- a/crates/gpui2/src/elements/text.rs +++ b/crates/gpui2/src/elements/text.rs @@ -12,7 +12,7 @@ use util::ResultExt; impl Element for &'static str { type State = TextState; - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext, @@ -42,7 +42,7 @@ impl IntoElement for &'static str { impl Element for SharedString { type State = TextState; - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext, @@ -118,7 +118,7 @@ impl StyledText { impl Element for StyledText { type State = TextState; - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext, @@ -331,7 +331,7 @@ impl InteractiveText { impl Element for InteractiveText { type State = InteractiveTextState; - fn layout( + fn request_layout( &mut self, state: Option, cx: &mut WindowContext, @@ -340,14 +340,14 @@ impl Element for InteractiveText { mouse_down_index, .. }) = state { - let (layout_id, text_state) = self.text.layout(None, cx); + let (layout_id, text_state) = self.text.request_layout(None, cx); let element_state = InteractiveTextState { text_state, mouse_down_index, }; (layout_id, element_state) } else { - let (layout_id, text_state) = self.text.layout(None, cx); + let (layout_id, text_state) = self.text.request_layout(None, cx); let element_state = InteractiveTextState { text_state, mouse_down_index: Rc::default(), diff --git a/crates/gpui2/src/elements/uniform_list.rs b/crates/gpui2/src/elements/uniform_list.rs index 1c237ff6ddc379473cdf8d7b5b59336593d1269c..ffa678e9e5ed4ef8281c97067bc411451dda507e 100644 --- a/crates/gpui2/src/elements/uniform_list.rs +++ b/crates/gpui2/src/elements/uniform_list.rs @@ -116,7 +116,7 @@ pub struct UniformListState { impl Element for UniformList { type State = UniformListState; - fn layout( + fn request_layout( &mut self, state: Option, cx: &mut WindowContext, diff --git a/crates/gpui2/src/platform/mac.rs b/crates/gpui2/src/platform/mac.rs index 344910de3bc40600a8b74d6f8ad41e54b7652507..d10793a618683ad3c1aa76bef860c468dfce2229 100644 --- a/crates/gpui2/src/platform/mac.rs +++ b/crates/gpui2/src/platform/mac.rs @@ -13,23 +13,13 @@ mod window; mod window_appearence; use crate::{px, size, GlobalPixels, Pixels, Size}; -use anyhow::anyhow; use cocoa::{ base::{id, nil}, - foundation::{NSAutoreleasePool, NSNotFound, NSRect, NSSize, NSString, NSUInteger, NSURL}, + foundation::{NSAutoreleasePool, NSNotFound, NSRect, NSSize, NSString, NSUInteger}, }; use metal_renderer::*; -use objc::{ - msg_send, - runtime::{BOOL, NO, YES}, - sel, sel_impl, -}; -use std::{ - ffi::{c_char, CStr, OsStr}, - ops::Range, - os::unix::prelude::OsStrExt, - path::PathBuf, -}; +use objc::runtime::{BOOL, NO, YES}; +use std::ops::Range; pub use dispatcher::*; pub use display::*; @@ -147,19 +137,3 @@ impl From for Size { // && self.origin.y + self.size.height >= other.origin.y // } // } - -// todo! -#[allow(unused)] -unsafe fn ns_url_to_path(url: id) -> crate::Result { - let path: *mut c_char = msg_send![url, fileSystemRepresentation]; - if path.is_null() { - Err(anyhow!( - "url is not a file path: {}", - CStr::from_ptr(url.absoluteString().UTF8String()).to_string_lossy() - )) - } else { - Ok(PathBuf::from(OsStr::from_bytes( - CStr::from_ptr(path).to_bytes(), - ))) - } -} diff --git a/crates/gpui2/src/platform/mac/events.rs b/crates/gpui2/src/platform/mac/events.rs index b2d68497efc831a7e61b8c235756e95fade6af0c..c67018ad5d4666ec8ae15511e4739f811ebcf309 100644 --- a/crates/gpui2/src/platform/mac/events.rs +++ b/crates/gpui2/src/platform/mac/events.rs @@ -34,8 +34,6 @@ unsafe fn build_event_source() { mem::forget(source); } -// todo! -#[allow(unused)] pub fn key_to_native(key: &str) -> Cow { use cocoa::appkit::*; let code = match key { diff --git a/crates/gpui2/src/platform/mac/window.rs b/crates/gpui2/src/platform/mac/window.rs index 27e8718a5a3c3309e41640f78334e505694e81e0..2dd77446a326579a0a73e742dc9d3e6dbd338515 100644 --- a/crates/gpui2/src/platform/mac/window.rs +++ b/crates/gpui2/src/platform/mac/window.rs @@ -74,7 +74,6 @@ const NSWindowAnimationBehaviorUtilityWindow: NSInteger = 4; #[allow(non_upper_case_globals)] const NSViewLayerContentsRedrawDuringViewResize: NSInteger = 2; // https://developer.apple.com/documentation/appkit/nsdragoperation -#[allow(non_upper_case_globals)] type NSDragOperation = NSUInteger; #[allow(non_upper_case_globals)] const NSDragOperationNone: NSDragOperation = 0; diff --git a/crates/gpui2/src/scene.rs b/crates/gpui2/src/scene.rs index ad43ab829b295208589fa62ad0a3d5a5062b3426..7640b9b2d3519c25e62a976a3ad2c4bc7877ce38 100644 --- a/crates/gpui2/src/scene.rs +++ b/crates/gpui2/src/scene.rs @@ -159,7 +159,6 @@ pub struct Scene { } impl Scene { - #[allow(dead_code)] pub fn paths(&self) -> &[Path] { &self.paths } diff --git a/crates/gpui2/src/view.rs b/crates/gpui2/src/view.rs index b090ea64c70395ad827a5cb1aacf63af092b2862..39b01c61e0f4a50e9f97df23f92744854fb7389c 100644 --- a/crates/gpui2/src/view.rs +++ b/crates/gpui2/src/view.rs @@ -81,12 +81,12 @@ impl View { impl Element for View { type State = Option; - fn layout( + fn request_layout( &mut self, _state: Option, cx: &mut WindowContext, ) -> (LayoutId, Self::State) { - let mut element = self.update(cx, |view, cx| view.render(cx).into_any()); + let mut element = self.update(cx, |view, cx| view.render(cx).into_any_element()); let layout_id = element.layout(cx); (layout_id, Some(element)) } @@ -229,7 +229,7 @@ impl From> for AnyView { impl Element for AnyView { type State = Option; - fn layout( + fn request_layout( &mut self, _state: Option, cx: &mut WindowContext, @@ -313,14 +313,14 @@ impl std::fmt::Debug for AnyWeakView { } mod any_view { - use crate::{AnyElement, AnyView, Element, LayoutId, Render, WindowContext}; + use crate::{AnyElement, AnyView, IntoElement, LayoutId, Render, WindowContext}; pub(crate) fn layout( view: &AnyView, cx: &mut WindowContext, ) -> (LayoutId, AnyElement) { let view = view.clone().downcast::().unwrap(); - let mut element = view.update(cx, |view, cx| view.render(cx).into_any()); + let mut element = view.update(cx, |view, cx| view.render(cx).into_any_element()); let layout_id = element.layout(cx); (layout_id, element) } diff --git a/crates/quick_action_bar2/src/quick_action_bar.rs b/crates/quick_action_bar2/src/quick_action_bar.rs index 5cbd1f6bcdd9b6208bfea6b90e695295c3f9343f..44ca0150e85a108ca2b371fb7f345efd1823d3fc 100644 --- a/crates/quick_action_bar2/src/quick_action_bar.rs +++ b/crates/quick_action_bar2/src/quick_action_bar.rs @@ -136,9 +136,9 @@ impl QuickActionBarButton { } impl RenderOnce for QuickActionBarButton { - type Rendered = IconButton; + type Output = IconButton; - fn render(self, _: &mut WindowContext) -> Self::Rendered { + fn render(self, _: &mut WindowContext) -> Self::Output { let tooltip = self.tooltip.clone(); let action = self.action.boxed_clone(); diff --git a/crates/recent_projects2/src/highlighted_workspace_location.rs b/crates/recent_projects2/src/highlighted_workspace_location.rs index a4057d2f4bdd090ca46a4f4242bc5b1abdb8e157..2df4409a5fdc20b15ef8e14ccd3b56d082fd1745 100644 --- a/crates/recent_projects2/src/highlighted_workspace_location.rs +++ b/crates/recent_projects2/src/highlighted_workspace_location.rs @@ -43,9 +43,9 @@ impl HighlightedText { } impl RenderOnce for HighlightedText { - type Rendered = HighlightedLabel; + type Output = HighlightedLabel; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { HighlightedLabel::new(self.text, self.highlight_positions) } } diff --git a/crates/search2/src/buffer_search.rs b/crates/search2/src/buffer_search.rs index 02e664a10953e329fe703f7d900f7f49c5a59dd1..671bcd68a71c0a916b2fcc289425c5464ee037e1 100644 --- a/crates/search2/src/buffer_search.rs +++ b/crates/search2/src/buffer_search.rs @@ -181,7 +181,11 @@ impl Render for BufferSearchBar { if in_replace { key_context.add("in_replace"); } - + let editor_border = if self.query_contains_error { + Color::Error.color(cx) + } else { + cx.theme().colors().border + }; h_stack() .w_full() .gap_2() @@ -217,7 +221,7 @@ impl Render for BufferSearchBar { .py_1() .gap_2() .border_1() - .border_color(cx.theme().colors().border) + .border_color(editor_border) .rounded_lg() .child(IconElement::new(Icon::MagnifyingGlass)) .child(self.render_text_input(&self.query_editor, cx)) @@ -852,6 +856,7 @@ impl BufferSearchBar { Ok(query) => query.with_replacement(self.replacement(cx)), Err(_) => { self.query_contains_error = true; + self.active_match_index = None; cx.notify(); return done_rx; } @@ -868,6 +873,7 @@ impl BufferSearchBar { Ok(query) => query.with_replacement(self.replacement(cx)), Err(_) => { self.query_contains_error = true; + self.active_match_index = None; cx.notify(); return done_rx; } diff --git a/crates/search2/src/project_search.rs b/crates/search2/src/project_search.rs index efb60c414c7d5aa47a895bd6c02a951916678545..ab94466cf71822d9e235d4ac464e31587780a764 100644 --- a/crates/search2/src/project_search.rs +++ b/crates/search2/src/project_search.rs @@ -13,10 +13,10 @@ use editor::{ use editor::{EditorElement, EditorStyle}; use gpui::{ actions, div, AnyElement, AnyView, AppContext, Context as _, Element, EntityId, EventEmitter, - FocusHandle, FocusableView, FontStyle, FontWeight, InteractiveElement, IntoElement, KeyContext, - Model, ModelContext, ParentElement, PromptLevel, Render, SharedString, Styled, Subscription, - Task, TextStyle, View, ViewContext, VisualContext, WeakModel, WeakView, WhiteSpace, - WindowContext, + FocusHandle, FocusableView, FontStyle, FontWeight, Hsla, InteractiveElement, IntoElement, + KeyContext, Model, ModelContext, ParentElement, PromptLevel, Render, SharedString, Styled, + Subscription, Task, TextStyle, View, ViewContext, VisualContext, WeakModel, WeakView, + WhiteSpace, WindowContext, }; use menu::Confirm; use project::{ @@ -1007,33 +1007,46 @@ impl ProjectSearchView { } fn build_search_query(&mut self, cx: &mut ViewContext) -> Option { + // Do not bail early in this function, as we want to fill out `self.panels_with_errors`. let text = self.query_editor.read(cx).text(cx); let included_files = match Self::parse_path_matches(&self.included_files_editor.read(cx).text(cx)) { Ok(included_files) => { - self.panels_with_errors.remove(&InputPanel::Include); + let should_unmark_error = self.panels_with_errors.remove(&InputPanel::Include); + if should_unmark_error { + cx.notify(); + } included_files } Err(_e) => { - self.panels_with_errors.insert(InputPanel::Include); - cx.notify(); - return None; + let should_mark_error = self.panels_with_errors.insert(InputPanel::Include); + if should_mark_error { + cx.notify(); + } + vec![] } }; let excluded_files = match Self::parse_path_matches(&self.excluded_files_editor.read(cx).text(cx)) { Ok(excluded_files) => { - self.panels_with_errors.remove(&InputPanel::Exclude); + let should_unmark_error = self.panels_with_errors.remove(&InputPanel::Exclude); + if should_unmark_error { + cx.notify(); + } + excluded_files } Err(_e) => { - self.panels_with_errors.insert(InputPanel::Exclude); - cx.notify(); - return None; + let should_mark_error = self.panels_with_errors.insert(InputPanel::Exclude); + if should_mark_error { + cx.notify(); + } + vec![] } }; + let current_mode = self.current_mode; - match current_mode { + let query = match current_mode { SearchMode::Regex => { match SearchQuery::regex( text, @@ -1044,12 +1057,20 @@ impl ProjectSearchView { excluded_files, ) { Ok(query) => { - self.panels_with_errors.remove(&InputPanel::Query); + let should_unmark_error = + self.panels_with_errors.remove(&InputPanel::Query); + if should_unmark_error { + cx.notify(); + } + Some(query) } Err(_e) => { - self.panels_with_errors.insert(InputPanel::Query); - cx.notify(); + let should_mark_error = self.panels_with_errors.insert(InputPanel::Query); + if should_mark_error { + cx.notify(); + } + None } } @@ -1063,16 +1084,27 @@ impl ProjectSearchView { excluded_files, ) { Ok(query) => { - self.panels_with_errors.remove(&InputPanel::Query); + let should_unmark_error = self.panels_with_errors.remove(&InputPanel::Query); + if should_unmark_error { + cx.notify(); + } + Some(query) } Err(_e) => { - self.panels_with_errors.insert(InputPanel::Query); - cx.notify(); + let should_mark_error = self.panels_with_errors.insert(InputPanel::Query); + if should_mark_error { + cx.notify(); + } + None } }, + }; + if !self.panels_with_errors.is_empty() { + return None; } + query } fn parse_path_matches(text: &str) -> anyhow::Result> { @@ -1185,6 +1217,13 @@ impl ProjectSearchView { SearchMode::Semantic => "\nSimply explain the code you are looking to find. ex. 'prompt user for permissions to index their project'".into() } } + fn border_color_for(&self, panel: InputPanel, cx: &WindowContext) -> Hsla { + if self.panels_with_errors.contains(&panel) { + Color::Error.color(cx) + } else { + cx.theme().colors().border + } + } } impl Default for ProjectSearchBar { @@ -1507,6 +1546,7 @@ impl Render for ProjectSearchBar { } let search = search.read(cx); let semantic_is_available = SemanticIndex::enabled(cx); + let query_column = v_stack().child( h_stack() .min_w(rems(512. / 16.)) @@ -1515,7 +1555,7 @@ impl Render for ProjectSearchBar { .gap_2() .bg(cx.theme().colors().editor_background) .border_1() - .border_color(cx.theme().colors().border) + .border_color(search.border_color_for(InputPanel::Query, cx)) .rounded_lg() .on_action(cx.listener(|this, action, cx| this.confirm(action, cx))) .on_action(cx.listener(|this, action, cx| this.previous_history_query(action, cx))) @@ -1789,7 +1829,7 @@ impl Render for ProjectSearchBar { .px_2() .py_1() .border_1() - .border_color(cx.theme().colors().border) + .border_color(search.border_color_for(InputPanel::Include, cx)) .rounded_lg() .child(self.render_text_input(&search.included_files_editor, cx)) .when(search.current_mode != SearchMode::Semantic, |this| { @@ -1815,7 +1855,7 @@ impl Render for ProjectSearchBar { .px_2() .py_1() .border_1() - .border_color(cx.theme().colors().border) + .border_color(search.border_color_for(InputPanel::Exclude, cx)) .rounded_lg() .child(self.render_text_input(&search.excluded_files_editor, cx)), ), diff --git a/crates/story/src/story.rs b/crates/story/src/story.rs index 3419af95b099807609b52b40b9775b17457975a0..1a3e84c0d919d91caac5b0d6bc90654510237714 100644 --- a/crates/story/src/story.rs +++ b/crates/story/src/story.rs @@ -74,9 +74,9 @@ impl ParentElement for StoryContainer { } impl RenderOnce for StoryContainer { - type Rendered = Stateful
; + type Output = Stateful
; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { div() .size_full() .flex() @@ -294,9 +294,9 @@ impl StoryItem { } impl RenderOnce for StoryItem { - type Rendered = Div; + type Output = Div; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { div() .my_2() .flex() @@ -358,9 +358,9 @@ impl StorySection { } impl RenderOnce for StorySection { - type Rendered = Div; + type Output = Div; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { let children: SmallVec<[AnyElement; 2]> = SmallVec::from_iter(Itertools::intersperse_with( self.children.into_iter(), || Story::divider().into_any_element(), diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs index 73d1abac55c93e87136169b57ab5d2a93777c3ff..4ae6279d75e69c3c2f40eb44f7cf009e0d4ac872 100644 --- a/crates/storybook2/src/stories/z_index.rs +++ b/crates/storybook2/src/stories/z_index.rs @@ -80,9 +80,9 @@ struct ZIndexExample { } impl RenderOnce for ZIndexExample { - type Rendered = Div; + type Output = Div; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { div() .relative() .size_full() diff --git a/crates/terminal_view2/src/terminal_element.rs b/crates/terminal_view2/src/terminal_element.rs index cb46f742f66135c2148fd6073ef010889bc1d8cd..8be10f9469fd8a2fb716f469c39bae841500920e 100644 --- a/crates/terminal_view2/src/terminal_element.rs +++ b/crates/terminal_view2/src/terminal_element.rs @@ -750,7 +750,7 @@ impl TerminalElement { impl Element for TerminalElement { type State = InteractiveElementState; - fn layout( + fn request_layout( &mut self, element_state: Option, cx: &mut WindowContext<'_>, diff --git a/crates/text2/src/text2.rs b/crates/text2/src/text2.rs index f0931a76724aca3a01533f6a58e9ffe9970ad005..fd23d3dca40d85e17fe41ca1154145d4807c3da2 100644 --- a/crates/text2/src/text2.rs +++ b/crates/text2/src/text2.rs @@ -1189,7 +1189,6 @@ impl Buffer { self.undo_or_redo(transaction).log_err() } - #[allow(clippy::needless_collect)] pub fn undo_to_transaction(&mut self, transaction_id: TransactionId) -> Vec { let transactions = self .history @@ -1223,7 +1222,6 @@ impl Buffer { } } - #[allow(clippy::needless_collect)] pub fn redo_to_transaction(&mut self, transaction_id: TransactionId) -> Vec { let transactions = self .history @@ -1536,7 +1534,6 @@ impl Buffer { edits } - #[allow(clippy::type_complexity)] pub fn randomly_edit( &mut self, rng: &mut T, diff --git a/crates/ui2/src/components/avatar.rs b/crates/ui2/src/components/avatar.rs index 793872cd8abf7ecdb86911d2d7eb373d36cf4fab..257e46989b6faf0b615d668aa3d18e3ede8dc83d 100644 --- a/crates/ui2/src/components/avatar.rs +++ b/crates/ui2/src/components/avatar.rs @@ -16,9 +16,9 @@ pub struct Avatar { } impl RenderOnce for Avatar { - type Rendered = Div; + type Output = Div; - fn render(mut self, cx: &mut WindowContext) -> Self::Rendered { + fn render(mut self, cx: &mut WindowContext) -> Self::Output { if self.image.style().corner_radii.top_left.is_none() { self = self.shape(Shape::Circle); } diff --git a/crates/ui2/src/components/button/button.rs b/crates/ui2/src/components/button/button.rs index bc5d03d639ffe4ba4fb1d5c8c6886268b7660159..2ad12919fba8a0daf31b3c7d54d0032ee5777e1b 100644 --- a/crates/ui2/src/components/button/button.rs +++ b/crates/ui2/src/components/button/button.rs @@ -136,9 +136,9 @@ impl ButtonCommon for Button { } impl RenderOnce for Button { - type Rendered = ButtonLike; + type Output = ButtonLike; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { let is_disabled = self.base.disabled; let is_selected = self.base.selected; diff --git a/crates/ui2/src/components/button/button_icon.rs b/crates/ui2/src/components/button/button_icon.rs index 3b2c703938bf0564179a1ce3b9305933b55b0810..a82aa14e6ed249d6615c01d6d4567510afdf9d9f 100644 --- a/crates/ui2/src/components/button/button_icon.rs +++ b/crates/ui2/src/components/button/button_icon.rs @@ -63,9 +63,9 @@ impl Selectable for ButtonIcon { } impl RenderOnce for ButtonIcon { - type Rendered = IconElement; + type Output = IconElement; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { let icon = self .selected_icon .filter(|_| self.selected) diff --git a/crates/ui2/src/components/button/button_like.rs b/crates/ui2/src/components/button/button_like.rs index 13d4f360f21b03d029e42ee2893f8742dfd0091d..0f304ae15d970172825a0ae7f487da7b3ac555b1 100644 --- a/crates/ui2/src/components/button/button_like.rs +++ b/crates/ui2/src/components/button/button_like.rs @@ -363,9 +363,9 @@ impl ParentElement for ButtonLike { } impl RenderOnce for ButtonLike { - type Rendered = Stateful
; + type Output = Stateful
; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { self.base .h_flex() .id(self.id.clone()) diff --git a/crates/ui2/src/components/button/icon_button.rs b/crates/ui2/src/components/button/icon_button.rs index 3a53bb6cb0178ffb3046d385debd3c0ecb35d23d..9dcb0c04d49f671331a2f0f8d0e1ed7620d98626 100644 --- a/crates/ui2/src/components/button/icon_button.rs +++ b/crates/ui2/src/components/button/icon_button.rs @@ -106,9 +106,9 @@ impl VisibleOnHover for IconButton { } impl RenderOnce for IconButton { - type Rendered = ButtonLike; + type Output = ButtonLike; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { let is_disabled = self.base.disabled; let is_selected = self.base.selected; diff --git a/crates/ui2/src/components/button/toggle_button.rs b/crates/ui2/src/components/button/toggle_button.rs index 4a6ecdeb2fc6cea673e8f695a35e0b7ec7cfa517..7ac642011f97299dabbd483abf0ed49f41a02ead 100644 --- a/crates/ui2/src/components/button/toggle_button.rs +++ b/crates/ui2/src/components/button/toggle_button.rs @@ -99,9 +99,9 @@ impl ButtonCommon for ToggleButton { } impl RenderOnce for ToggleButton { - type Rendered = ButtonLike; + type Output = ButtonLike; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { let is_disabled = self.base.disabled; let is_selected = self.base.selected; diff --git a/crates/ui2/src/components/checkbox.rs b/crates/ui2/src/components/checkbox.rs index 51e38a38f4fbceca10ceec6af0ed475dd5b6eb86..fd92e9694608da5e273f32f262e55bd7b771b220 100644 --- a/crates/ui2/src/components/checkbox.rs +++ b/crates/ui2/src/components/checkbox.rs @@ -19,9 +19,9 @@ pub struct Checkbox { } impl RenderOnce for Checkbox { - type Rendered = gpui::Stateful
; + type Output = gpui::Stateful
; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { let group_id = format!("checkbox_group_{:?}", self.id); let icon = match self.checked { diff --git a/crates/ui2/src/components/disclosure.rs b/crates/ui2/src/components/disclosure.rs index 729023986d2f1bda905c17850d2e209bc982071b..663fba30ca873536319f08680dcacaf9ba0bd7e7 100644 --- a/crates/ui2/src/components/disclosure.rs +++ b/crates/ui2/src/components/disclosure.rs @@ -28,9 +28,9 @@ impl Disclosure { } impl RenderOnce for Disclosure { - type Rendered = IconButton; + type Output = IconButton; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { IconButton::new( self.id, match self.is_open { diff --git a/crates/ui2/src/components/divider.rs b/crates/ui2/src/components/divider.rs index 20744d6c48e94ea80312acd9bf3ef63b7a30496f..dd30ce0ec57e60f78d37b764656c8507ca7bb242 100644 --- a/crates/ui2/src/components/divider.rs +++ b/crates/ui2/src/components/divider.rs @@ -31,9 +31,9 @@ pub struct Divider { } impl RenderOnce for Divider { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { div() .map(|this| match self.direction { DividerDirection::Horizontal => { diff --git a/crates/ui2/src/components/icon.rs b/crates/ui2/src/components/icon.rs index a168f97a50f047fbf8d338a779c46f6cfef57639..b0eed862505f990d05e3c74c8e471e1f9e606c95 100644 --- a/crates/ui2/src/components/icon.rs +++ b/crates/ui2/src/components/icon.rs @@ -196,9 +196,9 @@ pub struct IconElement { } impl RenderOnce for IconElement { - type Rendered = Svg; + type Output = Svg; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { svg() .size(self.size.rems()) .flex_none() diff --git a/crates/ui2/src/components/indicator.rs b/crates/ui2/src/components/indicator.rs index 4a94650dfc6cdd4a17290413587c2fd17898e20f..f3dc62d20f4d8b057320d74aa49e182d0869e7f9 100644 --- a/crates/ui2/src/components/indicator.rs +++ b/crates/ui2/src/components/indicator.rs @@ -45,9 +45,9 @@ impl Indicator { } impl RenderOnce for Indicator { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { div() .flex_none() .map(|this| match self.style { diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rs index 8314f607fefd24a968fa2b5b099594985929736c..f0de9891a7f2c21729ade7a69cc464966f4f93cd 100644 --- a/crates/ui2/src/components/keybinding.rs +++ b/crates/ui2/src/components/keybinding.rs @@ -11,9 +11,9 @@ pub struct KeyBinding { } impl RenderOnce for KeyBinding { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { h_stack() .flex_none() .gap_2() @@ -91,9 +91,9 @@ pub struct Key { } impl RenderOnce for Key { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { let single_char = self.key.len() == 1; div() @@ -125,9 +125,9 @@ pub struct KeyIcon { } impl RenderOnce for KeyIcon { - type Rendered = Div; + type Output = Div; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { div() .w(rems(14. / 16.)) .child(IconElement::new(self.icon).size(IconSize::Small)) diff --git a/crates/ui2/src/components/label/highlighted_label.rs b/crates/ui2/src/components/label/highlighted_label.rs index a7fbb0d8167cd0f78fd40f01454621a3e26ca33d..08dfbe2391a270e9a019d8df59d9ececc413cd8c 100644 --- a/crates/ui2/src/components/label/highlighted_label.rs +++ b/crates/ui2/src/components/label/highlighted_label.rs @@ -46,9 +46,9 @@ impl LabelCommon for HighlightedLabel { } impl RenderOnce for HighlightedLabel { - type Rendered = LabelLike; + type Output = LabelLike; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { let highlight_color = cx.theme().colors().text_accent; let mut highlight_indices = self.highlight_indices.iter().copied().peekable(); diff --git a/crates/ui2/src/components/label/label.rs b/crates/ui2/src/components/label/label.rs index 8272340888837ca3f2ec2a0294a3168c14009cd0..888cd506d78d77ec2314b31ca48c28f0c288a7af 100644 --- a/crates/ui2/src/components/label/label.rs +++ b/crates/ui2/src/components/label/label.rs @@ -40,9 +40,9 @@ impl LabelCommon for Label { } impl RenderOnce for Label { - type Rendered = LabelLike; + type Output = LabelLike; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { self.base.child(self.label) } } diff --git a/crates/ui2/src/components/label/label_like.rs b/crates/ui2/src/components/label/label_like.rs index ebfbbecceb6d2468d3c7da98929d3cd4bd20f1ba..54e383eb487e274140eb433b18c560f21f5daa20 100644 --- a/crates/ui2/src/components/label/label_like.rs +++ b/crates/ui2/src/components/label/label_like.rs @@ -76,9 +76,9 @@ impl ParentElement for LabelLike { } impl RenderOnce for LabelLike { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { div() .when(self.strikethrough, |this| { this.relative().child( diff --git a/crates/ui2/src/components/list/list.rs b/crates/ui2/src/components/list/list.rs index fdfe256bd6b40b3c3926e74d517c28dc1f2f9216..23ebd8427c55932f6df6ad8e0a2b79fbac708096 100644 --- a/crates/ui2/src/components/list/list.rs +++ b/crates/ui2/src/components/list/list.rs @@ -46,9 +46,9 @@ impl ParentElement for List { } impl RenderOnce for List { - type Rendered = Div; + type Output = Div; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { v_stack().w_full().py_1().children(self.header).map(|this| { match (self.children.is_empty(), self.toggle) { (false, _) => this.children(self.children), diff --git a/crates/ui2/src/components/list/list_header.rs b/crates/ui2/src/components/list/list_header.rs index 0c07867c6d08941258488349b67498b25e832d1b..9726ed2c2b524f999a9f178237faff51e8164866 100644 --- a/crates/ui2/src/components/list/list_header.rs +++ b/crates/ui2/src/components/list/list_header.rs @@ -76,9 +76,9 @@ impl Selectable for ListHeader { } impl RenderOnce for ListHeader { - type Rendered = Stateful
; + type Output = Stateful
; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { h_stack() .id(self.label.clone()) .w_full() diff --git a/crates/ui2/src/components/list/list_item.rs b/crates/ui2/src/components/list/list_item.rs index 6295e2940d3a086d77b4d1aadec98b8c44f1d765..403c24b8e52344ac53b295cc10ac9811e3150313 100644 --- a/crates/ui2/src/components/list/list_item.rs +++ b/crates/ui2/src/components/list/list_item.rs @@ -147,9 +147,9 @@ impl ParentElement for ListItem { } impl RenderOnce for ListItem { - type Rendered = Stateful
; + type Output = Stateful
; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { h_stack() .id(self.id) .w_full() diff --git a/crates/ui2/src/components/list/list_separator.rs b/crates/ui2/src/components/list/list_separator.rs index 346b13ddaa3d7f672813724022a323f29c6b720a..d7afb0ed930e260a8dba20cefd584e44b56a1593 100644 --- a/crates/ui2/src/components/list/list_separator.rs +++ b/crates/ui2/src/components/list/list_separator.rs @@ -6,9 +6,9 @@ use crate::prelude::*; pub struct ListSeparator; impl RenderOnce for ListSeparator { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { div() .h_px() .w_full() diff --git a/crates/ui2/src/components/list/list_sub_header.rs b/crates/ui2/src/components/list/list_sub_header.rs index 07a99dabe5bbb29bd25bde471948b709350123dc..9f49587a458eba5c8668bad17771609bbd7a493f 100644 --- a/crates/ui2/src/components/list/list_sub_header.rs +++ b/crates/ui2/src/components/list/list_sub_header.rs @@ -26,9 +26,9 @@ impl ListSubHeader { } impl RenderOnce for ListSubHeader { - type Rendered = Div; + type Output = Div; - fn render(self, _cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Output { h_stack().flex_1().w_full().relative().py_1().child( div() .h_6() diff --git a/crates/ui2/src/components/popover.rs b/crates/ui2/src/components/popover.rs index 91713bc3072ad76fd1344fe1eebc32b23171163f..7d888ed3aa4f17dd68a14932102facbc606f0cca 100644 --- a/crates/ui2/src/components/popover.rs +++ b/crates/ui2/src/components/popover.rs @@ -41,9 +41,9 @@ pub struct Popover { } impl RenderOnce for Popover { - type Rendered = Div; + type Output = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { div() .flex() .gap_1() diff --git a/crates/ui2/src/components/popover_menu.rs b/crates/ui2/src/components/popover_menu.rs index 1a02dd526e464a7c9ef7483bf575afc21f24c753..3cc925e0b5f0db95cb04553fc330d82a124a4833 100644 --- a/crates/ui2/src/components/popover_menu.rs +++ b/crates/ui2/src/components/popover_menu.rs @@ -130,7 +130,7 @@ pub struct PopoverMenuState { impl Element for PopoverMenu { type State = PopoverMenuState; - fn layout( + fn request_layout( &mut self, element_state: Option, cx: &mut WindowContext, diff --git a/crates/ui2/src/components/right_click_menu.rs b/crates/ui2/src/components/right_click_menu.rs index a3a454d652fa4dcbea48a6c8114c7c83e390c555..81f553a6a2cb2c2fdef829098e5ee5047358fb05 100644 --- a/crates/ui2/src/components/right_click_menu.rs +++ b/crates/ui2/src/components/right_click_menu.rs @@ -60,7 +60,7 @@ pub struct MenuHandleState { impl Element for RightClickMenu { type State = MenuHandleState; - fn layout( + fn request_layout( &mut self, element_state: Option, cx: &mut WindowContext, diff --git a/crates/ui2/src/components/tab.rs b/crates/ui2/src/components/tab.rs index eddfab811914b721126ccf777c9818498e405569..567013ef2bca07c211f9341c652374ebf99021b7 100644 --- a/crates/ui2/src/components/tab.rs +++ b/crates/ui2/src/components/tab.rs @@ -93,9 +93,9 @@ impl ParentElement for Tab { } impl RenderOnce for Tab { - type Rendered = Stateful
; + type Output = Stateful
; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { let (text_color, tab_bg, _tab_hover_bg, _tab_active_bg) = match self.selected { false => ( cx.theme().colors().text_muted, diff --git a/crates/ui2/src/components/tab_bar.rs b/crates/ui2/src/components/tab_bar.rs index c0d9953196dae47733d687e5f91e4b125dd2bcf8..f3a654eb4736067f4269f3bd1ad94e7090a4efa6 100644 --- a/crates/ui2/src/components/tab_bar.rs +++ b/crates/ui2/src/components/tab_bar.rs @@ -89,9 +89,9 @@ impl ParentElement for TabBar { } impl RenderOnce for TabBar { - type Rendered = Stateful
; + type Output = Stateful
; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, cx: &mut WindowContext) -> Self::Output { const HEIGHT_IN_REMS: f32 = 30. / 16.; div() diff --git a/crates/workspace2/src/pane_group.rs b/crates/workspace2/src/pane_group.rs index 800d03a50cbc718d13566a3270ac317c28e105a5..c6eaa71663b0a8a4619e95e602b37ea85a06808a 100644 --- a/crates/workspace2/src/pane_group.rs +++ b/crates/workspace2/src/pane_group.rs @@ -773,7 +773,7 @@ mod element { impl Element for PaneAxisElement { type State = Rc>>; - fn layout( + fn request_layout( &mut self, state: Option, cx: &mut ui::prelude::WindowContext, diff --git a/crates/workspace2/src/workspace2.rs b/crates/workspace2/src/workspace2.rs index f98d6a7bb254ec51b9422f92921d22ef3fb36fbf..596004c30d575651625307d48fb0c53e1d3b50e4 100644 --- a/crates/workspace2/src/workspace2.rs +++ b/crates/workspace2/src/workspace2.rs @@ -4285,7 +4285,7 @@ struct DisconnectedOverlay; impl Element for DisconnectedOverlay { type State = AnyElement; - fn layout( + fn request_layout( &mut self, _: Option, cx: &mut WindowContext,