Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Rename `S` type to `V`
Marshall Bowers1887f3b594f1
diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rsindex 7fa078c4e3f..15f66fc26a2 100644--- a/crates/storybook2/src/stories/z_index.rs+++ b/crates/storybook2/src/stories/z_index.rs@@ -14,7 +14,7 @@ impl ZIndexStory {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title(cx, "z-index")).child(diff --git a/crates/ui2/src/components/buffer.rs b/crates/ui2/src/components/buffer.rsindex b4ccb89b5c9..ee8271a94d2 100644--- a/crates/ui2/src/components/buffer.rs+++ b/crates/ui2/src/components/buffer.rs@@ -154,7 +154,7 @@ impl Buffer {self}- fn render_row<S: 'static>(row: BufferRow, cx: &WindowContext) -> impl Component<S> {+ fn render_row<V: 'static>(row: BufferRow, cx: &WindowContext) -> impl Component<V> {let theme = theme(cx);let line_background = if row.current {@@ -204,7 +204,7 @@ impl Buffer {}))}- fn render_rows<S: 'static>(&self, cx: &WindowContext) -> Vec<impl Component<S>> {+ fn render_rows<V: 'static>(&self, cx: &WindowContext) -> Vec<impl Component<V>> {match &self.rows {Some(rows) => rows.rows@@ -215,7 +215,7 @@ impl Buffer {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let rows = self.render_rows(cx);@@ -250,7 +250,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);Story::container(cx)diff --git a/crates/ui2/src/components/chat_panel.rs b/crates/ui2/src/components/chat_panel.rsindex 5155d700100..10e9e2a7068 100644--- a/crates/ui2/src/components/chat_panel.rs+++ b/crates/ui2/src/components/chat_panel.rs@@ -22,7 +22,7 @@ impl ChatPanel {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().id(self.element_id.clone()).flex()@@ -84,7 +84,7 @@ impl ChatMessage {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().flex().flex_col()@@ -121,7 +121,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, ChatPanel>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/collab_panel.rs b/crates/ui2/src/components/collab_panel.rsindex 6d2cbd8e14e..b8d0510f8fc 100644--- a/crates/ui2/src/components/collab_panel.rs+++ b/crates/ui2/src/components/collab_panel.rs@@ -14,7 +14,7 @@ impl CollabPanel {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);v_stack()@@ -101,7 +101,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, CollabPanel>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/command_palette.rs b/crates/ui2/src/components/command_palette.rsindex 065ee9a052b..038dc7f460b 100644--- a/crates/ui2/src/components/command_palette.rs+++ b/crates/ui2/src/components/command_palette.rs@@ -11,7 +11,7 @@ impl CommandPalette {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().id(self.id.clone()).child(Palette::new("palette").items(example_editor_actions())@@ -39,7 +39,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, CommandPalette>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rsindex 206f5a2f31b..f39df6879dc 100644--- a/crates/ui2/src/components/context_menu.rs+++ b/crates/ui2/src/components/context_menu.rs@@ -43,7 +43,7 @@ impl ContextMenu {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);v_stack()@@ -80,7 +80,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, ContextMenu>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/copilot.rs b/crates/ui2/src/components/copilot.rsindex 3c48ef20d08..a33dc1a0b78 100644--- a/crates/ui2/src/components/copilot.rs+++ b/crates/ui2/src/components/copilot.rs@@ -10,7 +10,7 @@ impl CopilotModal {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().id(self.id.clone()).child(Modal::new("some-id").title("Connect Copilot to Zed")@@ -37,7 +37,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, CopilotModal>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/facepile.rs b/crates/ui2/src/components/facepile.rsindex 898489f1edb..1d0f435eacf 100644--- a/crates/ui2/src/components/facepile.rs+++ b/crates/ui2/src/components/facepile.rs@@ -13,7 +13,7 @@ impl Facepile {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let player_count = self.players.len();let player_list = self.players.iter().enumerate().map(|(ix, player)| {let isnt_last = ix < player_count - 1;@@ -43,7 +43,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let players = static_players();Story::container(cx)diff --git a/crates/ui2/src/components/icon_button.rs b/crates/ui2/src/components/icon_button.rsindex 2891ce6bd83..b591c937b00 100644--- a/crates/ui2/src/components/icon_button.rs+++ b/crates/ui2/src/components/icon_button.rs@@ -5,27 +5,27 @@ use gpui2::MouseButton;use crate::{h_stack, prelude::*};use crate::{ClickHandler, Icon, IconColor, IconElement};-struct IconButtonHandlers<S: 'static> {- click: Option<ClickHandler<S>>,+struct IconButtonHandlers<V: 'static> {+ click: Option<ClickHandler<V>>,}-impl<S: 'static> Default for IconButtonHandlers<S> {+impl<V: 'static> Default for IconButtonHandlers<V> {fn default() -> Self {Self { click: None }}}#[derive(Component)]-pub struct IconButton<S: 'static> {+pub struct IconButton<V: 'static> {id: ElementId,icon: Icon,color: IconColor,variant: ButtonVariant,state: InteractionState,- handlers: IconButtonHandlers<S>,+ handlers: IconButtonHandlers<V>,}-impl<S: 'static> IconButton<S> {+impl<V: 'static> IconButton<V> {pub fn new(id: impl Into<ElementId>, icon: Icon) -> Self {Self {id: id.into(),@@ -57,12 +57,12 @@ impl<S: 'static> IconButton<S> {self}- pub fn on_click(mut self, handler: impl 'static + Fn(&mut S, &mut ViewContext<S>) + Send + Sync) -> Self {+ pub fn on_click(mut self, handler: impl 'static + Fn(&mut V, &mut ViewContext<V>) + Send + Sync) -> Self {self.handlers.click = Some(Arc::new(handler));self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {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.rsindex 2b0eefa4eaa..822cdd1dcb6 100644--- a/crates/ui2/src/components/keybinding.rs+++ b/crates/ui2/src/components/keybinding.rs@@ -29,7 +29,7 @@ impl Keybinding {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().flex().gap_2()@@ -59,7 +59,7 @@ impl Key {Self { key: key.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);div()diff --git a/crates/ui2/src/components/language_selector.rs b/crates/ui2/src/components/language_selector.rsindex db42b282811..92af80cd76c 100644--- a/crates/ui2/src/components/language_selector.rs+++ b/crates/ui2/src/components/language_selector.rs@@ -11,7 +11,7 @@ impl LanguageSelector {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().id(self.id.clone()).child(Palette::new("palette").items(vec![@@ -50,7 +50,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, LanguageSelector>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rsindex bfd650b390d..9557e68d7fd 100644--- a/crates/ui2/src/components/list.rs+++ b/crates/ui2/src/components/list.rs@@ -55,7 +55,7 @@ impl ListHeader {self}- fn disclosure_control<S: 'static>(&self) -> Div<S> {+ fn disclosure_control<V: 'static>(&self) -> Div<V> {let is_toggleable = self.toggleable != Toggleable::NotToggleable;let is_toggled = Toggleable::is_toggled(&self.toggleable);@@ -88,7 +88,7 @@ impl ListHeader {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let is_toggleable = self.toggleable != Toggleable::NotToggleable;@@ -151,7 +151,7 @@ impl ListSubHeader {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {h_stack().flex_1().w_full().relative().py_1().child(div().h_6()@@ -192,39 +192,39 @@ pub enum ListEntrySize {}#[derive(Component)]-pub enum ListItem<S: 'static> {+pub enum ListItem<V: 'static> {Entry(ListEntry),- Details(ListDetailsEntry<S>),+ Details(ListDetailsEntry<V>),Separator(ListSeparator),Header(ListSubHeader),}-impl<S: 'static> From<ListEntry> for ListItem<S> {+impl<V: 'static> From<ListEntry> for ListItem<V> {fn from(entry: ListEntry) -> Self {Self::Entry(entry)}}-impl<S: 'static> From<ListDetailsEntry<S>> for ListItem<S> {- fn from(entry: ListDetailsEntry<S>) -> Self {+impl<V: 'static> From<ListDetailsEntry<V>> for ListItem<V> {+ fn from(entry: ListDetailsEntry<V>) -> Self {Self::Details(entry)}}-impl<S: 'static> From<ListSeparator> for ListItem<S> {+impl<V: 'static> From<ListSeparator> for ListItem<V> {fn from(entry: ListSeparator) -> Self {Self::Separator(entry)}}-impl<S: 'static> From<ListSubHeader> for ListItem<S> {+impl<V: 'static> From<ListSubHeader> for ListItem<V> {fn from(entry: ListSubHeader) -> Self {Self::Header(entry)}}-impl<S: 'static> ListItem<S> {- fn render(self, view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+impl<V: 'static> ListItem<V> {+ fn render(self, view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {match self {ListItem::Entry(entry) => div().child(entry.render(view, cx)),ListItem::Separator(separator) => div().child(separator.render(view, cx)),@@ -361,7 +361,7 @@ impl ListEntry {}}- fn render<S: 'static>(mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(mut self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let settings = user_settings(cx);let theme = theme(cx);@@ -417,29 +417,29 @@ impl ListEntry {}}-struct ListDetailsEntryHandlers<S: 'static> {- click: Option<ClickHandler<S>>,+struct ListDetailsEntryHandlers<V: 'static> {+ click: Option<ClickHandler<V>>,}-impl<S: 'static> Default for ListDetailsEntryHandlers<S> {+impl<V: 'static> Default for ListDetailsEntryHandlers<V> {fn default() -> Self {Self { click: None }}}#[derive(Component)]-pub struct ListDetailsEntry<S: 'static> {+pub struct ListDetailsEntry<V: 'static> {label: SharedString,meta: Option<SharedString>,left_content: Option<LeftContent>,- handlers: ListDetailsEntryHandlers<S>,- actions: Option<Vec<Button<S>>>,+ handlers: ListDetailsEntryHandlers<V>,+ actions: Option<Vec<Button<V>>>,// TODO: make this more generic instead of// specifically for notificationsseen: bool,}-impl<S: 'static> ListDetailsEntry<S> {+impl<V: 'static> ListDetailsEntry<V> {pub fn new(label: impl Into<SharedString>) -> Self {Self {label: label.into(),@@ -461,17 +461,17 @@ impl<S: 'static> ListDetailsEntry<S> {self}- pub fn on_click(mut self, handler: ClickHandler<S>) -> Self {+ pub fn on_click(mut self, handler: ClickHandler<V>) -> Self {self.handlers.click = Some(handler);self}- pub fn actions(mut self, actions: Vec<Button<S>>) -> Self {+ pub fn actions(mut self, actions: Vec<Button<V>>) -> Self {self.actions = Some(actions);self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let settings = user_settings(cx);@@ -531,15 +531,15 @@ impl ListSeparator {}#[derive(Component)]-pub struct List<S: 'static> {- items: Vec<ListItem<S>>,+pub struct List<V: 'static> {+ items: Vec<ListItem<V>>,empty_message: SharedString,header: Option<ListHeader>,toggleable: Toggleable,}-impl<S: 'static> List<S> {- pub fn new(items: Vec<ListItem<S>>) -> Self {+impl<V: 'static> List<V> {+ pub fn new(items: Vec<ListItem<V>>) -> Self {Self {items,empty_message: "No items".into(),@@ -563,7 +563,7 @@ impl<S: 'static> List<S> {self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let is_toggleable = self.toggleable != Toggleable::NotToggleable;let is_toggled = Toggleable::is_toggled(&self.toggleable);diff --git a/crates/ui2/src/components/modal.rs b/crates/ui2/src/components/modal.rsindex 0ed1b0c72f8..7c3efe79bab 100644--- a/crates/ui2/src/components/modal.rs+++ b/crates/ui2/src/components/modal.rs@@ -4,15 +4,15 @@ use smallvec::SmallVec;use crate::{h_stack, prelude::*, v_stack, Button, Icon, IconButton, Label};#[derive(Component)]-pub struct Modal<S: 'static> {+pub struct Modal<V: 'static> {id: ElementId,title: Option<SharedString>,- primary_action: Option<Button<S>>,- secondary_action: Option<Button<S>>,- children: SmallVec<[AnyElement<S>; 2]>,+ primary_action: Option<Button<V>>,+ secondary_action: Option<Button<V>>,+ children: SmallVec<[AnyElement<V>; 2]>,}-impl<S: 'static> Modal<S> {+impl<V: 'static> Modal<V> {pub fn new(id: impl Into<ElementId>) -> Self {Self {id: id.into(),@@ -28,17 +28,17 @@ impl<S: 'static> Modal<S> {self}- pub fn primary_action(mut self, action: Button<S>) -> Self {+ pub fn primary_action(mut self, action: Button<V>) -> Self {self.primary_action = Some(action);self}- pub fn secondary_action(mut self, action: Button<S>) -> Self {+ pub fn secondary_action(mut self, action: Button<V>) -> Self {self.secondary_action = Some(action);self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);v_stack()@@ -76,8 +76,8 @@ impl<S: 'static> Modal<S> {}}-impl<S: 'static> ParentElement<S> for Modal<S> {- fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<S>; 2]> {+impl<V: 'static> ParentElement<V> for Modal<V> {+ fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<V>; 2]> {&mut self.children}}diff --git a/crates/ui2/src/components/notification_toast.rs b/crates/ui2/src/components/notification_toast.rsindex 6be3e3b1b55..f7d280ed160 100644--- a/crates/ui2/src/components/notification_toast.rs+++ b/crates/ui2/src/components/notification_toast.rs@@ -10,10 +10,7 @@ pub struct NotificationToast {impl NotificationToast {pub fn new(label: SharedString) -> Self {- Self {- label,- icon: None,- }+ Self { label, icon: None }}pub fn icon<I>(mut self, icon: I) -> Self@@ -24,7 +21,7 @@ impl NotificationToast {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);h_stack()diff --git a/crates/ui2/src/components/notifications_panel.rs b/crates/ui2/src/components/notifications_panel.rsindex e154d717d47..3e0c3887c5a 100644--- a/crates/ui2/src/components/notifications_panel.rs+++ b/crates/ui2/src/components/notifications_panel.rs@@ -1,4 +1,3 @@-use crate::{prelude::*, static_new_notification_items, static_read_notification_items};use crate::{List, ListHeader};@@ -9,12 +8,10 @@ pub struct NotificationsPanel {impl NotificationsPanel {pub fn new(id: impl Into<ElementId>) -> Self {- Self {- id: id.into(),- }+ Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);div()diff --git a/crates/ui2/src/components/palette.rs b/crates/ui2/src/components/palette.rsindex c2b7ba7e6c8..97f3df0b7c8 100644--- a/crates/ui2/src/components/palette.rs+++ b/crates/ui2/src/components/palette.rs@@ -42,7 +42,7 @@ impl Palette {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);v_stack()@@ -131,7 +131,7 @@ impl PaletteItem {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().flex().flex_row()diff --git a/crates/ui2/src/components/panel.rs b/crates/ui2/src/components/panel.rsindex 861babf27ca..7da2dab09a6 100644--- a/crates/ui2/src/components/panel.rs+++ b/crates/ui2/src/components/panel.rs@@ -39,17 +39,17 @@ pub enum PanelSide {use std::collections::HashSet;#[derive(Component)]-pub struct Panel<S: 'static> {+pub struct Panel<V: 'static> {id: ElementId,current_side: PanelSide,/// Defaults to PanelAllowedSides::LeftAndRightallowed_sides: PanelAllowedSides,initial_width: AbsoluteLength,width: Option<AbsoluteLength>,- children: SmallVec<[AnyElement<S>; 2]>,+ children: SmallVec<[AnyElement<V>; 2]>,}-impl<S: 'static> Panel<S> {+impl<V: 'static> Panel<V> {pub fn new(id: impl Into<ElementId>, cx: &mut WindowContext) -> Self {let settings = user_settings(cx);@@ -92,7 +92,7 @@ impl<S: 'static> Panel<S> {self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let current_size = self.width.unwrap_or(self.initial_width);@@ -117,8 +117,8 @@ impl<S: 'static> Panel<S> {}}-impl<S: 'static> ParentElement<S> for Panel<S> {- fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<S>; 2]> {+impl<V: 'static> ParentElement<V> for Panel<V> {+ fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<V>; 2]> {&mut self.children}}@@ -140,9 +140,9 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx)- .child(Story::title_for::<_, Panel<S>>(cx))+ .child(Story::title_for::<_, Panel<V>>(cx)).child(Story::label(cx, "Default")).child(Panel::new("panel", cx).child(diff --git a/crates/ui2/src/components/player_stack.rs b/crates/ui2/src/components/player_stack.rsindex 8c2d0bbf257..ced761a086c 100644--- a/crates/ui2/src/components/player_stack.rs+++ b/crates/ui2/src/components/player_stack.rs@@ -13,7 +13,7 @@ impl PlayerStack {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);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.rsindex 0898b70c8e4..61458ad4a06 100644--- a/crates/ui2/src/components/project_panel.rs+++ b/crates/ui2/src/components/project_panel.rs@@ -13,7 +13,7 @@ impl ProjectPanel {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);div()@@ -69,7 +69,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, ProjectPanel>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/recent_projects.rs b/crates/ui2/src/components/recent_projects.rsindex 67a32ad009d..81da295c3a7 100644--- a/crates/ui2/src/components/recent_projects.rs+++ b/crates/ui2/src/components/recent_projects.rs@@ -11,7 +11,7 @@ impl RecentProjects {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().id(self.id.clone()).child(Palette::new("palette").items(vec![@@ -46,7 +46,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, RecentProjects>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/tab_bar.rs b/crates/ui2/src/components/tab_bar.rsindex 4ebf7c63769..4c27d85f031 100644--- a/crates/ui2/src/components/tab_bar.rs+++ b/crates/ui2/src/components/tab_bar.rs@@ -23,7 +23,7 @@ impl TabBar {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let (can_navigate_back, can_navigate_forward) = self.can_navigate;@@ -104,7 +104,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, TabBar>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/terminal.rs b/crates/ui2/src/components/terminal.rsindex eb95458f0fb..4a38d205230 100644--- a/crates/ui2/src/components/terminal.rs+++ b/crates/ui2/src/components/terminal.rs@@ -11,7 +11,7 @@ impl Terminal {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let can_navigate_back = true;@@ -95,7 +95,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, Terminal>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/theme_selector.rs b/crates/ui2/src/components/theme_selector.rsindex 18dbaac407a..c1e1527d6c2 100644--- a/crates/ui2/src/components/theme_selector.rs+++ b/crates/ui2/src/components/theme_selector.rs@@ -11,7 +11,7 @@ impl ThemeSelector {Self { id: id.into() }}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().child(Palette::new(self.id.clone()).items(vec![@@ -51,7 +51,7 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx).child(Story::title_for::<_, ThemeSelector>(cx)).child(Story::label(cx, "Default"))diff --git a/crates/ui2/src/components/toast.rs b/crates/ui2/src/components/toast.rsindex 40c1e3a6a4a..626a79b3672 100644--- a/crates/ui2/src/components/toast.rs+++ b/crates/ui2/src/components/toast.rs@@ -23,12 +23,12 @@ pub enum ToastOrigin {////// Only one toast may be visible at a time.#[derive(Component)]-pub struct Toast<S: 'static> {+pub struct Toast<V: 'static> {origin: ToastOrigin,- children: SmallVec<[AnyElement<S>; 2]>,+ children: SmallVec<[AnyElement<V>; 2]>,}-impl<S: 'static> Toast<S> {+impl<V: 'static> Toast<V> {pub fn new(origin: ToastOrigin) -> Self {Self {origin,@@ -36,7 +36,7 @@ impl<S: 'static> Toast<S> {}}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let mut div = div();@@ -61,8 +61,8 @@ impl<S: 'static> Toast<S> {}}-impl<S: 'static> ParentElement<S> for Toast<S> {- fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<S>; 2]> {+impl<V: 'static> ParentElement<V> for Toast<V> {+ fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<V>; 2]> {&mut self.children}}@@ -84,9 +84,9 @@ mod stories {Self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {Story::container(cx)- .child(Story::title_for::<_, Toast<S>>(cx))+ .child(Story::title_for::<_, Toast<V>>(cx)).child(Story::label(cx, "Default")).child(Toast::new(ToastOrigin::Bottom).child(Label::new("label")))}diff --git a/crates/ui2/src/components/toolbar.rs b/crates/ui2/src/components/toolbar.rsindex 83bcde255eb..d3af4485e26 100644--- a/crates/ui2/src/components/toolbar.rs+++ b/crates/ui2/src/components/toolbar.rs@@ -7,12 +7,12 @@ use crate::prelude::*;pub struct ToolbarItem {}#[derive(Component)]-pub struct Toolbar<S: 'static> {- left_items: SmallVec<[AnyElement<S>; 2]>,- right_items: SmallVec<[AnyElement<S>; 2]>,+pub struct Toolbar<V: 'static> {+ left_items: SmallVec<[AnyElement<V>; 2]>,+ right_items: SmallVec<[AnyElement<V>; 2]>,}-impl<S: 'static> Toolbar<S> {+impl<V: 'static> Toolbar<V> {pub fn new() -> Self {Self {left_items: SmallVec::new(),@@ -20,7 +20,7 @@ impl<S: 'static> Toolbar<S> {}}- pub fn left_item(mut self, child: impl Component<S>) -> Self+ pub fn left_item(mut self, child: impl Component<V>) -> SelfwhereSelf: Sized,{@@ -28,7 +28,7 @@ impl<S: 'static> Toolbar<S> {self}- pub fn left_items(mut self, iter: impl IntoIterator<Item = impl Component<S>>) -> Self+ pub fn left_items(mut self, iter: impl IntoIterator<Item = impl Component<V>>) -> SelfwhereSelf: Sized,{@@ -37,7 +37,7 @@ impl<S: 'static> Toolbar<S> {self}- pub fn right_item(mut self, child: impl Component<S>) -> Self+ pub fn right_item(mut self, child: impl Component<V>) -> SelfwhereSelf: Sized,{@@ -45,7 +45,7 @@ impl<S: 'static> Toolbar<S> {self}- pub fn right_items(mut self, iter: impl IntoIterator<Item = impl Component<S>>) -> Self+ pub fn right_items(mut self, iter: impl IntoIterator<Item = impl Component<V>>) -> SelfwhereSelf: Sized,{@@ -54,7 +54,7 @@ impl<S: 'static> Toolbar<S> {self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);div()diff --git a/crates/ui2/src/components/traffic_lights.rs b/crates/ui2/src/components/traffic_lights.rsindex e3698adbf90..f9bba2828a8 100644--- a/crates/ui2/src/components/traffic_lights.rs+++ b/crates/ui2/src/components/traffic_lights.rs@@ -21,7 +21,7 @@ impl TrafficLight {}}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let fill = match (self.window_has_focus, self.color) {@@ -52,7 +52,7 @@ impl TrafficLights {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {div().flex().items_center()diff --git a/crates/ui2/src/element_ext.rs b/crates/ui2/src/element_ext.rsindex 69603bbb59c..bbdf6ded42f 100644--- a/crates/ui2/src/element_ext.rs+++ b/crates/ui2/src/element_ext.rs@@ -1,6 +1,6 @@use gpui2::Element;-pub trait ElementExt<S: 'static>: Element<S> {+pub trait ElementExt<V: 'static>: Element<V> {// fn when(mut self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self// where// Self: Sized,diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rsindex 24776c52c3a..b54944b45b8 100644--- a/crates/ui2/src/elements/button.rs+++ b/crates/ui2/src/elements/button.rs@@ -50,23 +50,23 @@ impl ButtonVariant {pub type ClickHandler<S> = Arc<dyn Fn(&mut S, &mut ViewContext<S>) + Send + Sync>;-struct ButtonHandlers<S: 'static> {- click: Option<ClickHandler<S>>,+struct ButtonHandlers<V: 'static> {+ click: Option<ClickHandler<V>>,}unsafe impl<S> Send for ButtonHandlers<S> {}unsafe impl<S> Sync for ButtonHandlers<S> {}-impl<S: 'static> Default for ButtonHandlers<S> {+impl<V: 'static> Default for ButtonHandlers<V> {fn default() -> Self {Self { click: None }}}#[derive(Component)]-pub struct Button<S: 'static> {+pub struct Button<V: 'static> {disabled: bool,- handlers: ButtonHandlers<S>,+ handlers: ButtonHandlers<V>,icon: Option<Icon>,icon_position: Option<IconPosition>,label: SharedString,@@ -74,7 +74,7 @@ pub struct Button<S: 'static> {width: Option<DefiniteLength>,}-impl<S: 'static> Button<S> {+impl<V: 'static> Button<V> {pub fn new(label: impl Into<SharedString>) -> Self {Self {disabled: false,@@ -114,7 +114,7 @@ impl<S: 'static> Button<S> {self}- pub fn on_click(mut self, handler: ClickHandler<S>) -> Self {+ pub fn on_click(mut self, handler: ClickHandler<V>) -> Self {self.handlers.click = Some(handler);self}@@ -150,7 +150,7 @@ impl<S: 'static> Button<S> {self.icon.map(|i| IconElement::new(i).color(icon_color))}- pub fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ pub fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let icon_color = self.icon_color();let mut button = h_stack()diff --git a/crates/ui2/src/elements/details.rs b/crates/ui2/src/elements/details.rsindex 21918297313..2ff87670662 100644--- a/crates/ui2/src/elements/details.rs+++ b/crates/ui2/src/elements/details.rs@@ -7,7 +7,7 @@ pub struct Details<V: 'static> {actions: Option<ButtonGroup<V>>,}-impl<S: 'static> Details<S> {+impl<V: 'static> Details<V> {pub fn new(text: &'static str) -> Self {Self {text,@@ -21,12 +21,12 @@ impl<S: 'static> Details<S> {self}- pub fn actions(mut self, actions: ButtonGroup<S>) -> Self {+ pub fn actions(mut self, actions: ButtonGroup<V>) -> Self {self.actions = Some(actions);self}- fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);v_stack()diff --git a/crates/ui2/src/elements/input.rs b/crates/ui2/src/elements/input.rsindex 30b930b315d..557a8c5f83c 100644--- a/crates/ui2/src/elements/input.rs+++ b/crates/ui2/src/elements/input.rs@@ -56,7 +56,7 @@ impl Input {self}- fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {let theme = theme(cx);let (input_bg, input_hover_bg, input_active_bg) = match self.variant {diff --git a/crates/ui2/src/elements/player.rs b/crates/ui2/src/elements/player.rsindex 12457e4f582..5bf890b8bb1 100644--- a/crates/ui2/src/elements/player.rs+++ b/crates/ui2/src/elements/player.rs@@ -138,12 +138,12 @@ impl Player {self}- pub fn cursor_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {+ pub fn cursor_color<V: 'static>(&self, cx: &mut ViewContext<V>) -> Hsla {let theme = theme(cx);theme.players[self.index].cursor}- pub fn selection_color<S: 'static>(&self, cx: &mut ViewContext<S>) -> Hsla {+ pub fn selection_color<V: 'static>(&self, cx: &mut ViewContext<V>) -> Hsla {let theme = theme(cx);theme.players[self.index].selection}diff --git a/crates/ui2/src/elements/stack.rs b/crates/ui2/src/elements/stack.rsindex 35ba00cecdb..1b019ad4d94 100644--- a/crates/ui2/src/elements/stack.rs+++ b/crates/ui2/src/elements/stack.rs@@ -14,18 +14,18 @@ pub trait Stack: Styled + Sized {}}-impl<S: 'static> Stack for Div<S> {}+impl<V: 'static> Stack for Div<V> {}/// Horizontally stacks elements.////// Sets `flex()`, `flex_row()`, `items_center()`-pub fn h_stack<S: 'static>() -> Div<S> {+pub fn h_stack<V: 'static>() -> Div<V> {div().h_stack()}/// Vertically stacks elements.////// Sets `flex()`, `flex_col()`-pub fn v_stack<S: 'static>() -> Div<S> {+pub fn v_stack<V: 'static>() -> Div<V> {div().v_stack()}diff --git a/crates/ui2/src/static_data.rs b/crates/ui2/src/static_data.rsindex f1b2405e72b..5f6d29a0814 100644--- a/crates/ui2/src/static_data.rs+++ b/crates/ui2/src/static_data.rs@@ -325,7 +325,7 @@ pub fn static_players_with_call_status() -> Vec<PlayerWithCallStatus> {]}-pub fn static_new_notification_items<S: 'static>() -> Vec<ListItem<S>> {+pub fn static_new_notification_items<V: 'static>() -> Vec<ListItem<V>> {vec![ListDetailsEntry::new("maxdeviant invited you to join a stream in #design.").meta("4 people in stream."),@@ -336,7 +336,7 @@ pub fn static_new_notification_items<S: 'static>() -> Vec<ListItem<S>> {.collect()}-pub fn static_read_notification_items<S: 'static>() -> Vec<ListItem<S>> {+pub fn static_read_notification_items<V: 'static>() -> Vec<ListItem<V>> {vec![ListDetailsEntry::new("mikaylamaki added you as a contact.").actions(vec![Button::new("Decline"),@@ -352,7 +352,7 @@ pub fn static_read_notification_items<S: 'static>() -> Vec<ListItem<S>> {.collect()}-pub fn static_project_panel_project_items<S: 'static>() -> Vec<ListItem<S>> {+pub fn static_project_panel_project_items<V: 'static>() -> Vec<ListItem<V>> {vec![ListEntry::new(Label::new("zed")).left_icon(Icon::FolderOpen.into())@@ -479,7 +479,7 @@ pub fn static_project_panel_project_items<S: 'static>() -> Vec<ListItem<S>> {.collect()}-pub fn static_project_panel_single_items<S: 'static>() -> Vec<ListItem<S>> {+pub fn static_project_panel_single_items<V: 'static>() -> Vec<ListItem<V>> {vec![ListEntry::new(Label::new("todo.md")).left_icon(Icon::FileDoc.into())@@ -496,7 +496,7 @@ pub fn static_project_panel_single_items<S: 'static>() -> Vec<ListItem<S>> {.collect()}-pub fn static_collab_panel_current_call<S: 'static>() -> Vec<ListItem<S>> {+pub fn static_collab_panel_current_call<V: 'static>() -> Vec<ListItem<V>> {vec![ListEntry::new(Label::new("as-cii")).left_avatar("http://github.com/as-cii.png?s=50"),ListEntry::new(Label::new("nathansobo"))@@ -509,7 +509,7 @@ pub fn static_collab_panel_current_call<S: 'static>() -> Vec<ListItem<S>> {.collect()}-pub fn static_collab_panel_channels<S: 'static>() -> Vec<ListItem<S>> {+pub fn static_collab_panel_channels<V: 'static>() -> Vec<ListItem<V>> {vec![ListEntry::new(Label::new("zed")).left_icon(Icon::Hash.into())diff --git a/crates/ui2/src/story.rs b/crates/ui2/src/story.rsindex fae65a16b70..d2813bd1745 100644--- a/crates/ui2/src/story.rs+++ b/crates/ui2/src/story.rs@@ -5,7 +5,7 @@ use crate::prelude::*;pub struct Story {}impl Story {- pub fn container<S: 'static>(cx: &mut ViewContext<S>) -> Div<S> {+ pub fn container<V: 'static>(cx: &mut ViewContext<V>) -> Div<V> {let theme = theme(cx);div()@@ -18,10 +18,7 @@ impl Story {.bg(theme.background)}- pub fn title<S: 'static>(- cx: &mut ViewContext<S>,- title: &str,- ) -> impl Component<S> {+ pub fn title<V: 'static>(cx: &mut ViewContext<V>, title: &str) -> impl Component<V> {let theme = theme(cx);div()@@ -30,14 +27,11 @@ impl Story {.child(title.to_owned())}- pub fn title_for<S: 'static, T>(cx: &mut ViewContext<S>) -> impl Component<S> {+ pub fn title_for<V: 'static, T>(cx: &mut ViewContext<V>) -> impl Component<V> {Self::title(cx, std::any::type_name::<T>())}- pub fn label<S: 'static>(- cx: &mut ViewContext<S>,- label: &str,- ) -> impl Component<S> {+ pub fn label<V: 'static>(cx: &mut ViewContext<V>, label: &str) -> impl Component<V> {let theme = theme(cx);div()