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.

Reconcile with upstream changes

Marshall Bowers8cd112110ea7
diff --git a/crates/gpui3_macros/src/derive_element.rs b/crates/gpui3_macros/src/derive_element.rs
index 08f50a92ba1..6c57f6c966d 100644
--- a/crates/gpui3_macros/src/derive_element.rs
+++ b/crates/gpui3_macros/src/derive_element.rs
@@ -21,30 +21,35 @@ pub fn derive_element(input: TokenStream) -> TokenStream {
impl #impl_generics gpui3::Element for #type_name #ty_generics
#where_clause
{
- type State = #state_type;
- type FrameState = gpui3::AnyElement<#state_type>;
+ type ViewState = #state_type;
+ type ElementState = gpui3::AnyElement<#state_type>;
+
+ fn element_id(&self) -> Option<gpui3::ElementId> {
+ None
+ }
fn layout(
&mut self,
state: &mut #state_type,
- cx: &mut gpui3::ViewContext<Self::State>,
- ) -> anyhow::Result<(gpui3::LayoutId, Self::FrameState)> {
+ element_state: Option<Self::ElementState>,
+ cx: &mut gpui3::ViewContext<Self::ViewState>,
+ ) -> (gpui3::LayoutId, Self::ElementState) {
use gpui3::IntoAnyElement;
let mut rendered_element = self.render(cx).into_any();
- let layout_id = rendered_element.layout(state, cx)?;
- Ok((layout_id, rendered_element))
+ let layout_id = rendered_element.layout(state, cx);
+ (layout_id, rendered_element)
}
fn paint(
&mut self,
bounds: gpui3::Bounds<gpui3::Pixels>,
- state: &mut Self::State,
- rendered_element: &mut Self::FrameState,
- cx: &mut gpui3::ViewContext<Self::State>,
- ) -> anyhow::Result<()> {
+ state: &mut Self::ViewState,
+ element_state: &mut Self::ElementState,
+ cx: &mut gpui3::ViewContext<Self::ViewState>,
+ ) {
// TODO: Where do we get the `offset` from?
- rendered_element.paint(state, None, cx)
+ element_state.paint(state, None, cx)
}
}
};
diff --git a/crates/storybook2/src/stories/kitchen_sink.rs b/crates/storybook2/src/stories/kitchen_sink.rs
index 325e84847f5..91e34d3c690 100644
--- a/crates/storybook2/src/stories/kitchen_sink.rs
+++ b/crates/storybook2/src/stories/kitchen_sink.rs
@@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync + Clone> KitchenSinkStory<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let element_stories = ElementStory::iter().map(|selector| selector.story());
let component_stories = ComponentStory::iter().map(|selector| selector.story());
diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs
index 17506484f17..89a146b4ece 100644
--- a/crates/storybook2/src/stories/z_index.rs
+++ b/crates/storybook2/src/stories/z_index.rs
@@ -19,7 +19,7 @@ impl<S: 'static + Send + Sync> ZIndexStory<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title(cx, "z-index"))
.child(
@@ -103,7 +103,7 @@ impl<S: 'static + Send + Sync> ZIndexExample<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div()
.relative()
.size_full()
diff --git a/crates/ui2/src/children.rs b/crates/ui2/src/children.rs
index c7c81e97263..e9a55d1cc04 100644
--- a/crates/ui2/src/children.rs
+++ b/crates/ui2/src/children.rs
@@ -4,4 +4,4 @@ use gpui3::{AnyElement, ViewContext};
pub type HackyChildren<S> = fn(&mut ViewContext<S>, &dyn Any) -> Vec<AnyElement<S>>;
-pub type HackyChildrenPayload = Box<dyn Any>;
+pub type HackyChildrenPayload = Box<dyn Any + Send + Sync>;
diff --git a/crates/ui2/src/components/assistant_panel.rs b/crates/ui2/src/components/assistant_panel.rs
index def22af18bb..00562519597 100644
--- a/crates/ui2/src/components/assistant_panel.rs
+++ b/crates/ui2/src/components/assistant_panel.rs
@@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync + Clone> AssistantPanel<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
struct PanelPayload {
@@ -110,7 +110,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, AssistantPanel<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/breadcrumb.rs b/crates/ui2/src/components/breadcrumb.rs
index 8572859c317..207142cd35c 100644
--- a/crates/ui2/src/components/breadcrumb.rs
+++ b/crates/ui2/src/components/breadcrumb.rs
@@ -31,7 +31,7 @@ impl<S: 'static + Send + Sync + Clone> Breadcrumb<S> {
.text_color(HighlightColor::Default.hsla(theme))
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let symbols_len = self.symbols.len();
@@ -99,7 +99,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
Story::container(cx)
diff --git a/crates/ui2/src/components/buffer.rs b/crates/ui2/src/components/buffer.rs
index 89ecad19dbf..aadacd950bc 100644
--- a/crates/ui2/src/components/buffer.rs
+++ b/crates/ui2/src/components/buffer.rs
@@ -162,7 +162,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
self
}
- fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<State = S> {
+ fn render_row(row: BufferRow, cx: &WindowContext) -> impl Element<ViewState = S> {
let theme = theme(cx);
let system_color = SystemColor::new();
@@ -213,7 +213,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
}))
}
- fn render_rows(&self, cx: &WindowContext) -> Vec<impl Element<State = S>> {
+ fn render_rows(&self, cx: &WindowContext) -> Vec<impl Element<ViewState = S>> {
match &self.rows {
Some(rows) => rows
.rows
@@ -224,7 +224,7 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let rows = self.render_rows(cx);
@@ -263,7 +263,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
Story::container(cx)
diff --git a/crates/ui2/src/components/chat_panel.rs b/crates/ui2/src/components/chat_panel.rs
index ab4f5853cef..c603576c787 100644
--- a/crates/ui2/src/components/chat_panel.rs
+++ b/crates/ui2/src/components/chat_panel.rs
@@ -25,7 +25,7 @@ impl<S: 'static + Send + Sync + Clone> ChatPanel<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -89,7 +89,7 @@ impl<S: 'static + Send + Sync + Clone> ChatMessage<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div()
.flex()
.flex_col()
@@ -130,7 +130,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ChatPanel<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/collab_panel.rs b/crates/ui2/src/components/collab_panel.rs
index 1900b7e2ac2..22a41af12f5 100644
--- a/crates/ui2/src/components/collab_panel.rs
+++ b/crates/ui2/src/components/collab_panel.rs
@@ -23,7 +23,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let color = ThemeColor::new(cx);
@@ -103,7 +103,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
label: impl Into<ArcCow<'static, str>>,
expanded: bool,
theme: &Theme,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
div()
.h_7()
.px_2()
@@ -131,7 +131,7 @@ impl<S: 'static + Send + Sync + Clone> CollabPanel<S> {
avatar_uri: impl Into<ArcCow<'static, str>>,
label: impl Into<ArcCow<'static, str>>,
theme: &Theme,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
div()
.h_7()
.px_2()
@@ -180,7 +180,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, CollabPanel<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/command_palette.rs b/crates/ui2/src/components/command_palette.rs
index 6c29a787f55..2d96d35df2e 100644
--- a/crates/ui2/src/components/command_palette.rs
+++ b/crates/ui2/src/components/command_palette.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> CommandPalette<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(example_editor_actions())
@@ -49,7 +49,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, CommandPalette<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rs
index f3ef79e920e..895ea71ea35 100644
--- a/crates/ui2/src/components/context_menu.rs
+++ b/crates/ui2/src/components/context_menu.rs
@@ -43,7 +43,7 @@ impl<S: 'static + Send + Sync + Clone> ContextMenu<S> {
items: items.into_iter().collect(),
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
v_stack()
@@ -87,7 +87,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ContextMenu<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/editor_pane.rs b/crates/ui2/src/components/editor_pane.rs
index 4460a6f7cde..bb9c5c26235 100644
--- a/crates/ui2/src/components/editor_pane.rs
+++ b/crates/ui2/src/components/editor_pane.rs
@@ -20,7 +20,7 @@ impl<S: 'static + Send + Sync + Clone> EditorPane<S> {
Self { editor }
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
struct LeftItemsPayload {
path: PathBuf,
symbols: Vec<Symbol>,
diff --git a/crates/ui2/src/components/facepile.rs b/crates/ui2/src/components/facepile.rs
index 3a0aa055c2f..77fc95bc149 100644
--- a/crates/ui2/src/components/facepile.rs
+++ b/crates/ui2/src/components/facepile.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> Facepile<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let player_count = self.players.len();
let player_list = self.players.iter().enumerate().map(|(ix, player)| {
@@ -52,7 +52,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let players = static_players();
Story::container(cx)
diff --git a/crates/ui2/src/components/icon_button.rs b/crates/ui2/src/components/icon_button.rs
index c7a6329ff30..91bb920811e 100644
--- a/crates/ui2/src/components/icon_button.rs
+++ b/crates/ui2/src/components/icon_button.rs
@@ -66,7 +66,7 @@ impl<S: 'static + Send + Sync> IconButton<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let icon_color = match (self.state, self.color) {
diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rs
index 3830d1a3e5f..67124a94143 100644
--- a/crates/ui2/src/components/keybinding.rs
+++ b/crates/ui2/src/components/keybinding.rs
@@ -35,7 +35,7 @@ impl<S: 'static + Send + Sync + Clone> Keybinding<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div()
.flex()
.gap_2()
@@ -72,7 +72,7 @@ impl<S: 'static + Send + Sync> Key<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -189,7 +189,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let all_modifier_permutations = ModifierKey::iter().permutations(2);
Story::container(cx)
diff --git a/crates/ui2/src/components/language_selector.rs b/crates/ui2/src/components/language_selector.rs
index 41e33596b86..6b6d16f4af8 100644
--- a/crates/ui2/src/components/language_selector.rs
+++ b/crates/ui2/src/components/language_selector.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> LanguageSelector<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(vec![
@@ -60,7 +60,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, LanguageSelector<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs
index 3897394a789..a9cc070272b 100644
--- a/crates/ui2/src/components/list.rs
+++ b/crates/ui2/src/components/list.rs
@@ -92,7 +92,7 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
let system_color = SystemColor::new();
@@ -164,7 +164,7 @@ impl<S: 'static + Send + Sync + Clone> ListSubHeader<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
@@ -237,7 +237,7 @@ impl<S: 'static + Send + Sync + Clone> From<ListSubHeader<S>> for ListItem<S> {
}
impl<S: 'static + Send + Sync + Clone> ListItem<S> {
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
match self {
ListItem::Entry(entry) => div().child(entry.render(cx)),
ListItem::Separator(separator) => div().child(separator.render(cx)),
@@ -346,7 +346,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
}
}
- fn disclosure_control(&mut self, cx: &mut ViewContext<S>) -> Option<impl Element<State = S>> {
+ fn disclosure_control(&mut self, cx: &mut ViewContext<S>) -> Option<impl Element<ViewState = S>> {
let theme = theme(cx);
let token = token();
@@ -369,7 +369,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
let system_color = SystemColor::new();
@@ -437,7 +437,7 @@ impl<S: 'static + Send + Sync> ListSeparator<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
div().h_px().w_full().fill(color.border)
@@ -477,7 +477,7 @@ impl<S: 'static + Send + Sync + Clone> List<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
diff --git a/crates/ui2/src/components/multi_buffer.rs b/crates/ui2/src/components/multi_buffer.rs
index d5a3d8f5397..8ab399732c8 100644
--- a/crates/ui2/src/components/multi_buffer.rs
+++ b/crates/ui2/src/components/multi_buffer.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> MultiBuffer<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
v_stack()
@@ -62,7 +62,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
Story::container(cx)
diff --git a/crates/ui2/src/components/palette.rs b/crates/ui2/src/components/palette.rs
index 0ee359db6a3..d498fb53aa6 100644
--- a/crates/ui2/src/components/palette.rs
+++ b/crates/ui2/src/components/palette.rs
@@ -47,7 +47,7 @@ impl<S: 'static + Send + Sync + Clone> Palette<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
v_stack()
@@ -134,7 +134,7 @@ impl<S: 'static + Send + Sync + Clone> PaletteItem<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -172,7 +172,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Palette<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/panel.rs b/crates/ui2/src/components/panel.rs
index f82dbad3e4b..7c796aac4f3 100644
--- a/crates/ui2/src/components/panel.rs
+++ b/crates/ui2/src/components/panel.rs
@@ -100,7 +100,7 @@ impl<S: 'static + Send + Sync> Panel<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let token = token();
let theme = theme(cx);
@@ -165,7 +165,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Panel<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/panes.rs b/crates/ui2/src/components/panes.rs
index 4c1ec66099c..ddad72348b9 100644
--- a/crates/ui2/src/components/panes.rs
+++ b/crates/ui2/src/components/panes.rs
@@ -48,7 +48,7 @@ impl<S: 'static + Send + Sync> Pane<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -89,7 +89,7 @@ impl<S: 'static + Send + Sync> PaneGroup<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
if !self.panes.is_empty() {
diff --git a/crates/ui2/src/components/player_stack.rs b/crates/ui2/src/components/player_stack.rs
index e88470da385..37c0db5fec2 100644
--- a/crates/ui2/src/components/player_stack.rs
+++ b/crates/ui2/src/components/player_stack.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync> PlayerStack<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let system_color = SystemColor::new();
let player = self.player_with_call_status.get_player();
self.player_with_call_status.get_call_status();
diff --git a/crates/ui2/src/components/project_panel.rs b/crates/ui2/src/components/project_panel.rs
index fb24dcd37e5..07e8f120586 100644
--- a/crates/ui2/src/components/project_panel.rs
+++ b/crates/ui2/src/components/project_panel.rs
@@ -20,7 +20,7 @@ impl<S: 'static + Send + Sync + Clone> ProjectPanel<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let color = ThemeColor::new(cx);
@@ -78,7 +78,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ProjectPanel<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/recent_projects.rs b/crates/ui2/src/components/recent_projects.rs
index 44f5bcbaf10..4e28cbd80d2 100644
--- a/crates/ui2/src/components/recent_projects.rs
+++ b/crates/ui2/src/components/recent_projects.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> RecentProjects<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(vec![
@@ -56,7 +56,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, RecentProjects<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/status_bar.rs b/crates/ui2/src/components/status_bar.rs
index 06e55bd9a6e..43cfed88d9d 100644
--- a/crates/ui2/src/components/status_bar.rs
+++ b/crates/ui2/src/components/status_bar.rs
@@ -83,7 +83,7 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -98,7 +98,7 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
.child(self.right_tools(&theme))
}
- fn left_tools(&self, theme: &Theme) -> impl Element<State = S> {
+ fn left_tools(&self, theme: &Theme) -> impl Element<ViewState = S> {
let workspace_state = get_workspace_state();
div()
@@ -129,7 +129,7 @@ impl<S: 'static + Send + Sync + Clone> StatusBar<S> {
.child(IconButton::new(Icon::XCircle))
}
- fn right_tools(&self, theme: &Theme) -> impl Element<State = S> {
+ fn right_tools(&self, theme: &Theme) -> impl Element<ViewState = S> {
let workspace_state = get_workspace_state();
div()
diff --git a/crates/ui2/src/components/tab.rs b/crates/ui2/src/components/tab.rs
index 8ed34580c9a..4757b243018 100644
--- a/crates/ui2/src/components/tab.rs
+++ b/crates/ui2/src/components/tab.rs
@@ -74,7 +74,7 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let has_fs_conflict = self.fs_status == FileSystemStatus::Conflict;
let is_deleted = self.fs_status == FileSystemStatus::Deleted;
@@ -157,7 +157,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let git_statuses = GitStatus::iter();
let fs_statuses = FileSystemStatus::iter();
diff --git a/crates/ui2/src/components/tab_bar.rs b/crates/ui2/src/components/tab_bar.rs
index 451dd858a0f..da958b5f403 100644
--- a/crates/ui2/src/components/tab_bar.rs
+++ b/crates/ui2/src/components/tab_bar.rs
@@ -23,7 +23,7 @@ impl<S: 'static + Send + Sync + Clone> TabBar<S> {
self.scroll_state = scroll_state;
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let can_navigate_back = true;
let can_navigate_forward = false;
@@ -105,7 +105,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, TabBar<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/terminal.rs b/crates/ui2/src/components/terminal.rs
index 18fdc40f457..d7cd12a00a5 100644
--- a/crates/ui2/src/components/terminal.rs
+++ b/crates/ui2/src/components/terminal.rs
@@ -18,7 +18,7 @@ impl<S: 'static + Send + Sync + Clone> Terminal<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let can_navigate_back = true;
@@ -109,7 +109,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Terminal<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/theme_selector.rs b/crates/ui2/src/components/theme_selector.rs
index 7bb49601dff..d25f1ac8d25 100644
--- a/crates/ui2/src/components/theme_selector.rs
+++ b/crates/ui2/src/components/theme_selector.rs
@@ -17,7 +17,7 @@ impl<S: 'static + Send + Sync + Clone> ThemeSelector<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
div().child(
Palette::new(self.scroll_state.clone())
.items(vec![
@@ -61,7 +61,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, ThemeSelector<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/title_bar.rs b/crates/ui2/src/components/title_bar.rs
index 1ab9efdd61e..0b9f57d3785 100644
--- a/crates/ui2/src/components/title_bar.rs
+++ b/crates/ui2/src/components/title_bar.rs
@@ -46,7 +46,7 @@ impl<S: 'static + Send + Sync + Clone> TitleBar<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
// let has_focus = cx.window_is_active();
let has_focus = true;
@@ -139,7 +139,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, TitleBar<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/toast.rs b/crates/ui2/src/components/toast.rs
index be165b4646c..ea7f9a1f108 100644
--- a/crates/ui2/src/components/toast.rs
+++ b/crates/ui2/src/components/toast.rs
@@ -41,7 +41,7 @@ impl<S: 'static + Send + Sync> Toast<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let color = ThemeColor::new(cx);
let mut div = div();
@@ -89,7 +89,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Toast<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/toolbar.rs b/crates/ui2/src/components/toolbar.rs
index 0c1d998d286..6ab85ae8156 100644
--- a/crates/ui2/src/components/toolbar.rs
+++ b/crates/ui2/src/components/toolbar.rs
@@ -27,7 +27,7 @@ impl<S: 'static + Send + Sync> Toolbar<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -74,7 +74,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
struct LeftItemsPayload {
diff --git a/crates/ui2/src/components/traffic_lights.rs b/crates/ui2/src/components/traffic_lights.rs
index fd7f67b904a..0e6bca2bd13 100644
--- a/crates/ui2/src/components/traffic_lights.rs
+++ b/crates/ui2/src/components/traffic_lights.rs
@@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> TrafficLight<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let system_color = SystemColor::new();
@@ -60,7 +60,7 @@ impl<S: 'static + Send + Sync> TrafficLights<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let token = token();
@@ -104,7 +104,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, TrafficLights<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/components/workspace.rs b/crates/ui2/src/components/workspace.rs
index 24417ae7ff3..49045e37255 100644
--- a/crates/ui2/src/components/workspace.rs
+++ b/crates/ui2/src/components/workspace.rs
@@ -125,7 +125,7 @@ impl<S: 'static + Send + Sync + Clone> WorkspaceElement<S> {
}
}
- pub fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ pub fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx).clone();
let workspace_state = get_workspace_state();
@@ -353,7 +353,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
// Just render the workspace without any story boilerplate.
WorkspaceElement::new()
}
diff --git a/crates/ui2/src/element_ext.rs b/crates/ui2/src/element_ext.rs
index 41c91c0450b..82bad3496a9 100644
--- a/crates/ui2/src/element_ext.rs
+++ b/crates/ui2/src/element_ext.rs
@@ -1,6 +1,6 @@
use gpui3::Element;
-pub trait ElementExt<S: 'static + Send + Sync>: Element<State = S> {
+pub trait ElementExt<S: 'static + Send + Sync>: Element<ViewState = S> {
/// Applies a given function `then` to the current element if `condition` is true.
/// This function is used to conditionally modify the element based on a given condition.
/// If `condition` is false, it just returns the current element as it is.
@@ -15,4 +15,4 @@ pub trait ElementExt<S: 'static + Send + Sync>: Element<State = S> {
}
}
-impl<S: 'static + Send + Sync, E: Element<State = S>> ElementExt<S> for E {}
+impl<S: 'static + Send + Sync, E: Element<ViewState = S>> ElementExt<S> for E {}
diff --git a/crates/ui2/src/elements/avatar.rs b/crates/ui2/src/elements/avatar.rs
index bb43d37e183..3f6031ece11 100644
--- a/crates/ui2/src/elements/avatar.rs
+++ b/crates/ui2/src/elements/avatar.rs
@@ -26,7 +26,7 @@ impl<S: 'static + Send + Sync> Avatar<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let mut img = img();
@@ -64,7 +64,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Avatar<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rs
index 67b7770d069..9708aec23ee 100644
--- a/crates/ui2/src/elements/button.rs
+++ b/crates/ui2/src/elements/button.rs
@@ -160,7 +160,7 @@ impl<S: 'static + Send + Sync + Clone> Button<S> {
self.icon.map(|i| IconElement::new(i).color(icon_color))
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let icon_color = self.icon_color();
let system_color = SystemColor::new();
@@ -229,7 +229,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let states = InteractionState::iter();
Story::container(cx)
diff --git a/crates/ui2/src/elements/details.rs b/crates/ui2/src/elements/details.rs
index 50b361ea8b1..22fa4531984 100644
--- a/crates/ui2/src/elements/details.rs
+++ b/crates/ui2/src/elements/details.rs
@@ -24,7 +24,7 @@ impl<S: 'static + Send + Sync + Clone> Details<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -60,7 +60,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Details<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/elements/icon.rs b/crates/ui2/src/elements/icon.rs
index b63eca561a5..4ea9b8c57b4 100644
--- a/crates/ui2/src/elements/icon.rs
+++ b/crates/ui2/src/elements/icon.rs
@@ -170,7 +170,7 @@ impl<S: 'static + Send + Sync> IconElement<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let fill = self.color.color(theme);
@@ -206,7 +206,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let icons = Icon::iter();
Story::container(cx)
diff --git a/crates/ui2/src/elements/input.rs b/crates/ui2/src/elements/input.rs
index d63f116ca38..9040f4847c0 100644
--- a/crates/ui2/src/elements/input.rs
+++ b/crates/ui2/src/elements/input.rs
@@ -45,7 +45,7 @@ impl<S: 'static + Send + Sync> Input<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let text_el;
@@ -128,7 +128,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Input<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/elements/label.rs b/crates/ui2/src/elements/label.rs
index a937468a357..e63cef7d21a 100644
--- a/crates/ui2/src/elements/label.rs
+++ b/crates/ui2/src/elements/label.rs
@@ -90,7 +90,7 @@ impl<S: 'static + Send + Sync + Clone> Label<S> {
self
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
let highlight_color = theme.lowest.accent.default.foreground;
@@ -185,7 +185,7 @@ mod stories {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
Story::container(cx)
.child(Story::title_for::<_, Label<S>>(cx))
.child(Story::label(cx, "Default"))
diff --git a/crates/ui2/src/elements/stack.rs b/crates/ui2/src/elements/stack.rs
index e8e547e006d..17d693dd48a 100644
--- a/crates/ui2/src/elements/stack.rs
+++ b/crates/ui2/src/elements/stack.rs
@@ -14,18 +14,18 @@ pub trait Stack: StyleHelpers {
}
}
-impl<S> Stack for Div<S> {}
+impl<S: 'static + Send + Sync> Stack for Div<S> {}
/// Horizontally stacks elements.
///
/// Sets `flex()`, `flex_row()`, `items_center()`
-pub fn h_stack<S: 'static>() -> Div<S> {
+pub fn h_stack<S: 'static + Send + Sync>() -> Div<S> {
div().h_stack()
}
/// Vertically stacks elements.
///
/// Sets `flex()`, `flex_col()`
-pub fn v_stack<S: 'static>() -> Div<S> {
+pub fn v_stack<S: 'static + Send + Sync>() -> Div<S> {
div().v_stack()
}
diff --git a/crates/ui2/src/elements/tool_divider.rs b/crates/ui2/src/elements/tool_divider.rs
index 96c730c2f61..215a5676095 100644
--- a/crates/ui2/src/elements/tool_divider.rs
+++ b/crates/ui2/src/elements/tool_divider.rs
@@ -15,7 +15,7 @@ impl<S: 'static + Send + Sync> ToolDivider<S> {
}
}
- fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<State = S> {
+ fn render(&mut self, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let theme = theme(cx);
div().w_px().h_3().fill(theme.lowest.base.default.border)
diff --git a/crates/ui2/src/story.rs b/crates/ui2/src/story.rs
index f1a3b1ab704..a6fac404258 100644
--- a/crates/ui2/src/story.rs
+++ b/crates/ui2/src/story.rs
@@ -22,7 +22,7 @@ impl Story {
pub fn title<S: 'static + Send + Sync>(
cx: &mut ViewContext<S>,
title: &str,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
@@ -33,14 +33,14 @@ impl Story {
pub fn title_for<S: 'static + Send + Sync, T>(
cx: &mut ViewContext<S>,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
Self::title(cx, std::any::type_name::<T>())
}
pub fn label<S: 'static + Send + Sync>(
cx: &mut ViewContext<S>,
label: &str,
- ) -> impl Element<State = S> {
+ ) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()