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 dispatch-tree

Conrad Irwinf464d69ff8c6
diff --cc crates/picker2/src/picker2.rs
index 9d75fcb8905,0a731b4a270..e1979f1b134
--- a/crates/picker2/src/picker2.rs
+++ b/crates/picker2/src/picker2.rs
@@@ -1,11 -1,11 +1,10 @@@
use editor::Editor;
use gpui::{
- div, uniform_list, Component, Div, FocusEnabled, ParentElement, Render, StatefulInteractivity,
- StatelessInteractive, Styled, Task, UniformListScrollHandle, View, ViewContext, VisualContext,
- WindowContext,
+ div, uniform_list, Component, Div, ParentElement, Render, StatelessInteractive, Styled, Task,
+ UniformListScrollHandle, View, ViewContext, VisualContext, WindowContext,
};
- use std::cmp;
- use theme::ActiveTheme;
- use ui::v_stack;
+ use std::{cmp, sync::Arc};
+ use ui::{prelude::*, v_stack, Divider, Label, LabelColor};
pub struct Picker<D: PickerDelegate> {
pub delegate: D,
@@@ -141,7 -145,10 +144,8 @@@ impl<D: PickerDelegate> Render for Pick
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div()
.context("picker")
- .id("picker-container")
- .focusable()
.size_full()
+ .elevation_2(cx)
.on_action(Self::select_next)
.on_action(Self::select_prev)
.on_action(Self::select_first)
diff --cc crates/ui2/src/styled_ext.rs
index 980b31fe5d9,3d6af476a48..0407d98f862
--- a/crates/ui2/src/styled_ext.rs
+++ b/crates/ui2/src/styled_ext.rs
@@@ -1,9 -1,18 +1,18 @@@
- use gpui::{Div, ElementInteractivity, KeyDispatch, Styled};
-use gpui::{Div, ElementFocus, ElementInteractivity, Styled, UniformList, ViewContext};
++use gpui::{Div, ElementInteractivity, KeyDispatch, Styled, UniformList, ViewContext};
+ use theme2::ActiveTheme;
- use crate::UITextSize;
+ use crate::{ElevationIndex, UITextSize};
+
+ fn elevated<E: Styled, V: 'static>(this: E, cx: &mut ViewContext<V>, index: ElevationIndex) -> E {
+ this.bg(cx.theme().colors().elevated_surface_background)
+ .rounded_lg()
+ .border()
+ .border_color(cx.theme().colors().border_variant)
+ .shadow(index.shadow())
+ }
/// Extends [`Styled`](gpui::Styled) with Zed specific styling methods.
- pub trait StyledExt: Styled {
+ pub trait StyledExt: Styled + Sized {
/// Horizontally stacks elements.
///
/// Sets `flex()`, `flex_row()`, `items_center()`
@@@ -69,6 -96,8 +96,8 @@@
impl<V, I, F> StyledExt for Div<V, I, F>
where
I: ElementInteractivity<V>,
- F: ElementFocus<V>,
+ F: KeyDispatch<V>,
{
}
+
+ impl<V> StyledExt for UniformList<V> {}