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.

Merge branch 'main' into element-types

Conrad Irwin37d0b8424c4c
diff --cc crates/picker2/src/picker2.rs
index 199941ef3b8,70cef678689..089e6097e44
--- a/crates/picker2/src/picker2.rs
+++ b/crates/picker2/src/picker2.rs
@@@ -1,10 -1,10 +1,10 @@@
use editor::Editor;
use gpui::{
- div, uniform_list, Component, Div, MouseButton, ParentElement, Render, StatelessInteractive,
- Styled, Task, UniformListScrollHandle, View, ViewContext, VisualContext, WindowContext,
+ div, prelude::*, uniform_list, Component, Div, MouseButton, Render, Task,
+ UniformListScrollHandle, View, ViewContext, WindowContext,
};
use std::{cmp, sync::Arc};
- use ui::{prelude::*, v_stack, Divider, Label, LabelColor};
+ use ui::{prelude::*, v_stack, Divider, Label, TextColor};
pub struct Picker<D: PickerDelegate> {
pub delegate: D,
diff --cc crates/ui2/src/components/button.rs
index e7acd9fdc1b,f3f3ba6a50f..8eff92f11aa
--- a/crates/ui2/src/components/button.rs
+++ b/crates/ui2/src/components/button.rs
@@@ -1,11 -1,9 +1,9 @@@
use std::sync::Arc;
-use gpui::{div, DefiniteLength, Hsla, MouseButton, WindowContext};
+use gpui::{div, DefiniteLength, Hsla, MouseButton, StatefulInteractiveComponent, WindowContext};
- use crate::{
- h_stack, prelude::*, Icon, IconButton, IconColor, IconElement, Label, LabelColor,
- LineHeightStyle,
- };
+ use crate::prelude::*;
+ use crate::{h_stack, Icon, IconButton, IconElement, Label, LineHeightStyle, TextColor};
/// Provides the flexibility to use either a standard
/// button or an icon button in a given context.
diff --cc crates/ui2/src/components/checkbox.rs
index 971da8338b5,3480c8cb721..5b9db177858
--- a/crates/ui2/src/components/checkbox.rs
+++ b/crates/ui2/src/components/checkbox.rs
@@@ -1,8 -1,12 +1,8 @@@
+use gpui::{div, prelude::*, Component, ElementId, Styled, ViewContext};
use std::sync::Arc;
-
-use gpui::{
- div, Component, ElementId, ParentElement, StatefulInteractive, StatelessInteractive, Styled,
- ViewContext,
-};
use theme2::ActiveTheme;
- use crate::{Icon, IconColor, IconElement, Selection};
+ use crate::{Icon, IconElement, Selection, TextColor};
pub type CheckHandler<V> = Arc<dyn Fn(Selection, &mut V, &mut ViewContext<V>) + Send + Sync>;
diff --cc crates/ui2/src/components/icon_button.rs
index c9982f1f671,b719a05b92e..7afaa122434
--- a/crates/ui2/src/components/icon_button.rs
+++ b/crates/ui2/src/components/icon_button.rs
@@@ -1,6 -1,5 +1,5 @@@
- use crate::{h_stack, prelude::*};
- use crate::{ClickHandler, Icon, IconColor, IconElement, TextTooltip};
-use crate::{h_stack, prelude::*, ClickHandler, Icon, IconElement, TextColor, TextTooltip};
-use gpui::{MouseButton, VisualContext};
++use crate::{h_stack, prelude::*, ClickHandler, Icon, IconElement, TextTooltip};
+use gpui::{prelude::*, MouseButton, VisualContext};
use std::sync::Arc;
struct IconButtonHandlers<V: 'static> {
diff --cc crates/ui2/src/components/input.rs
index 4db9222a0ec,9bcf5e4dba6..42de03db126
--- a/crates/ui2/src/components/input.rs
+++ b/crates/ui2/src/components/input.rs
@@@ -1,5 -1,6 +1,5 @@@
- use crate::{prelude::*, Label, LabelColor};
-use crate::prelude::*;
-use crate::Label;
-use crate::TextColor;
++use crate::{prelude::*, Label};
+use gpui::prelude::*;
#[derive(Default, PartialEq)]
pub enum InputVariant {
diff --cc crates/ui2/src/components/palette.rs
index c72722dc086,f1b50bb56de..5adf794a5ef
--- a/crates/ui2/src/components/palette.rs
+++ b/crates/ui2/src/components/palette.rs
@@@ -1,5 -1,5 +1,5 @@@
- use crate::{h_stack, prelude::*, v_stack, KeyBinding, Label, LabelColor};
-use crate::prelude::*;
-use crate::{h_stack, v_stack, KeyBinding, Label, TextColor};
++use crate::{h_stack, prelude::*, v_stack, KeyBinding, Label};
+use gpui::prelude::*;
#[derive(Component)]
pub struct Palette {
diff --cc crates/ui2/src/components/tab.rs
index 268098a579f,7128257628a..820fe5b361c
--- a/crates/ui2/src/components/tab.rs
+++ b/crates/ui2/src/components/tab.rs
@@@ -1,6 -1,6 +1,6 @@@
use crate::prelude::*;
- use crate::{Icon, IconColor, IconElement, Label, LabelColor};
+ use crate::{Icon, IconElement, Label, TextColor};
-use gpui::{red, Div, ElementId, Render, View, VisualContext};
+use gpui::{prelude::*, red, Div, ElementId, Render, View};
#[derive(Component, Clone)]
pub struct Tab {
diff --cc crates/ui2/src/components/toggle.rs
index f34f08e09e6,1683773e165..8388e275310
--- a/crates/ui2/src/components/toggle.rs
+++ b/crates/ui2/src/components/toggle.rs
@@@ -1,6 -1,6 +1,6 @@@
-use gpui::{div, Component, ParentElement};
+use gpui::{div, Component, ParentComponent};
- use crate::{Icon, IconColor, IconElement, IconSize};
+ use crate::{Icon, IconElement, IconSize, TextColor};
/// Whether the entry is toggleable, and if so, whether it is currently toggled.
///
diff --cc crates/ui2/src/components/tooltip.rs
index 231d4e856d1,58375b0b674..ca9e6d3eac7
--- a/crates/ui2/src/components/tooltip.rs
+++ b/crates/ui2/src/components/tooltip.rs
@@@ -1,11 -1,13 +1,13 @@@
- use gpui::{div, Div, ParentComponent, Render, SharedString, Styled, ViewContext};
-use gpui::{Div, Render};
++use gpui::{Div, ParentComponent, Render, SharedString, Styled, ViewContext};
use theme2::ActiveTheme;
- use crate::StyledExt;
+ use crate::prelude::*;
+ use crate::{h_stack, v_stack, KeyBinding, Label, LabelSize, StyledExt, TextColor};
- #[derive(Clone, Debug)]
pub struct TextTooltip {
title: SharedString,
+ meta: Option<SharedString>,
+ key_binding: Option<KeyBinding>,
}
impl TextTooltip {
diff --cc crates/ui2/src/to_extract/chat_panel.rs
index fcc8e6a46e8,b1d208fd671..7e2846a3f6b
--- a/crates/ui2/src/to_extract/chat_panel.rs
+++ b/crates/ui2/src/to_extract/chat_panel.rs
@@@ -1,6 -1,7 +1,6 @@@
- use crate::{prelude::*, Icon, IconButton, Input, Label, LabelColor};
++use crate::{prelude::*, Icon, IconButton, Input, Label};
use chrono::NaiveDateTime;
-
-use crate::prelude::*;
-use crate::{Icon, IconButton, Input, Label, TextColor};
+use gpui::prelude::*;
#[derive(Component)]
pub struct ChatPanel {
diff --cc crates/ui2/src/to_extract/editor_pane.rs
index fd21e81242c,f03323f93ff..bd34c22805a
--- a/crates/ui2/src/to_extract/editor_pane.rs
+++ b/crates/ui2/src/to_extract/editor_pane.rs
@@@ -60,12 -60,12 +60,12 @@@ impl Render for EditorPane
Toolbar::new()
.left_item(Breadcrumb::new(self.path.clone(), self.symbols.clone()))
.right_items(vec![
-- IconButton::new("toggle_inlay_hints", Icon::InlayHint),
++ IconButton::<Self>::new("toggle_inlay_hints", Icon::InlayHint),
IconButton::<Self>::new("buffer_search", Icon::MagnifyingGlass)
.when(self.is_buffer_search_open, |this| {
- this.color(IconColor::Accent)
+ this.color(TextColor::Accent)
})
-- .on_click(|editor, cx| {
++ .on_click(|editor: &mut Self, cx| {
editor.toggle_buffer_search(cx);
}),
IconButton::new("inline_assist", Icon::MagicWand),
diff --cc crates/ui2/src/to_extract/notifications_panel.rs
index a7854107b1c,98e11798513..f56194fc473
--- a/crates/ui2/src/to_extract/notifications_panel.rs
+++ b/crates/ui2/src/to_extract/notifications_panel.rs
@@@ -1,9 -1,10 +1,9 @@@
-use crate::utils::naive_format_distance_from_now;
use crate::{
- h_stack, prelude::*, static_new_notification_items_2, v_stack, Avatar, ButtonOrIconButton,
- Icon, IconElement, Label, LineHeightStyle, ListHeaderMeta, ListSeparator, PublicPlayer,
- TextColor, UnreadIndicator,
+ h_stack, prelude::*, static_new_notification_items_2, utils::naive_format_distance_from_now,
- v_stack, Avatar, ButtonOrIconButton, ClickHandler, Icon, IconElement, Label, LabelColor,
- LineHeightStyle, ListHeader, ListHeaderMeta, ListSeparator, PublicPlayer, UnreadIndicator,
++ v_stack, Avatar, ButtonOrIconButton, ClickHandler, Icon, IconElement, Label, LineHeightStyle,
++ ListHeader, ListHeaderMeta, ListSeparator, PublicPlayer, TextColor, UnreadIndicator,
};
-use crate::{ClickHandler, ListHeader};
+use gpui::prelude::*;
#[derive(Component)]
pub struct NotificationsPanel {
diff --cc crates/ui2/src/to_extract/status_bar.rs
index 34a5993e69d,bc236ea1fae..eee96ecad85
--- a/crates/ui2/src/to_extract/status_bar.rs
+++ b/crates/ui2/src/to_extract/status_bar.rs
@@@ -110,18 -110,18 +110,18 @@@ impl StatusBar
.child(
IconButton::<Workspace>::new("project_panel", Icon::FileTree)
.when(workspace.is_project_panel_open(), |this| {
- this.color(IconColor::Accent)
+ this.color(TextColor::Accent)
})
-- .on_click(|workspace, cx| {
++ .on_click(|workspace: &mut Workspace, cx| {
workspace.toggle_project_panel(cx);
}),
)
.child(
IconButton::<Workspace>::new("collab_panel", Icon::Hash)
.when(workspace.is_collab_panel_open(), |this| {
- this.color(IconColor::Accent)
+ this.color(TextColor::Accent)
})
-- .on_click(|workspace, cx| {
++ .on_click(|workspace: &mut Workspace, cx| {
workspace.toggle_collab_panel();
}),
)
@@@ -174,27 -174,27 +174,27 @@@
.child(
IconButton::<Workspace>::new("terminal", Icon::Terminal)
.when(workspace.is_terminal_open(), |this| {
- this.color(IconColor::Accent)
+ this.color(TextColor::Accent)
})
-- .on_click(|workspace, cx| {
++ .on_click(|workspace: &mut Workspace, cx| {
workspace.toggle_terminal(cx);
}),
)
.child(
IconButton::<Workspace>::new("chat_panel", Icon::MessageBubbles)
.when(workspace.is_chat_panel_open(), |this| {
- this.color(IconColor::Accent)
+ this.color(TextColor::Accent)
})
-- .on_click(|workspace, cx| {
++ .on_click(|workspace: &mut Workspace, cx| {
workspace.toggle_chat_panel(cx);
}),
)
.child(
IconButton::<Workspace>::new("assistant_panel", Icon::Ai)
.when(workspace.is_assistant_panel_open(), |this| {
- this.color(IconColor::Accent)
+ this.color(TextColor::Accent)
})
-- .on_click(|workspace, cx| {
++ .on_click(|workspace: &mut Workspace, cx| {
workspace.toggle_assistant_panel(cx);
}),
),
diff --cc crates/ui2/src/to_extract/title_bar.rs
index 87d7dd4146d,9aa8777a9d7..1a106cbf7a5
--- a/crates/ui2/src/to_extract/title_bar.rs
+++ b/crates/ui2/src/to_extract/title_bar.rs
@@@ -152,21 -152,21 +152,25 @@@ impl Render for TitleBar
.gap_1()
.child(
IconButton::<TitleBar>::new("toggle_mic_status", Icon::Mic)
- .when(self.is_mic_muted(), |this| this.color(IconColor::Error))
- .on_click(|title_bar, cx| title_bar.toggle_mic_status(cx)),
+ .when(self.is_mic_muted(), |this| this.color(TextColor::Error))
- .on_click(|title_bar, cx| title_bar.toggle_mic_status(cx)),
++ .on_click(|title_bar: &mut TitleBar, cx| {
++ title_bar.toggle_mic_status(cx)
++ }),
)
.child(
IconButton::<TitleBar>::new("toggle_deafened", Icon::AudioOn)
- .when(self.is_deafened, |this| this.color(IconColor::Error))
- .on_click(|title_bar, cx| title_bar.toggle_deafened(cx)),
+ .when(self.is_deafened, |this| this.color(TextColor::Error))
- .on_click(|title_bar, cx| title_bar.toggle_deafened(cx)),
++ .on_click(|title_bar: &mut TitleBar, cx| {
++ title_bar.toggle_deafened(cx)
++ }),
)
.child(
IconButton::<TitleBar>::new("toggle_screen_share", Icon::Screen)
.when(
self.screen_share_status == ScreenShareStatus::Shared,
- |this| this.color(IconColor::Accent),
+ |this| this.color(TextColor::Accent),
)
-- .on_click(|title_bar, cx| {
++ .on_click(|title_bar: &mut TitleBar, cx| {
title_bar.toggle_screen_share_status(cx)
}),
),
diff --cc crates/workspace2/src/workspace2.rs
index bba86b6beb2,7137a273d59..f0b40ab883c
--- a/crates/workspace2/src/workspace2.rs
+++ b/crates/workspace2/src/workspace2.rs
@@@ -3433,9 -3475,13 +3466,10 @@@ impl Workspace
let callback = callback.clone();
div.on_action(move |workspace, event, cx| (callback.clone())(workspace, event, cx))
}));
+ self
}
- fn add_workspace_actions_listeners(
- &self,
- mut div: Div<Workspace, StatelessInteractivity<Workspace>>,
- ) -> Div<Workspace, StatelessInteractivity<Workspace>> {
+ fn add_workspace_actions_listeners(&self, mut div: Div<Workspace>) -> Div<Workspace> {
for action in self.workspace_actions.iter() {
div = (action)(div)
}