Refine naming of element-related types and traits

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Nathan Sobo 2023-04-21 13:04:03 -06:00
parent 03619dfa55
commit fe492eacbf
93 changed files with 661 additions and 656 deletions

View file

@ -3,7 +3,7 @@ use std::sync::Arc;
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
use gpui::{
actions,
elements::{Drawable as _, Label},
elements::{Element as _, Label},
AppContext, Task, ViewContext,
};
use picker::{Picker, PickerDelegate, PickerEvent};
@ -134,7 +134,7 @@ impl PickerDelegate for BaseKeymapSelectorDelegate {
mouse_state: &mut gpui::MouseState,
selected: bool,
cx: &gpui::AppContext,
) -> gpui::Element<Picker<Self>> {
) -> gpui::AnyElement<Picker<Self>> {
let theme = &cx.global::<Settings>().theme;
let keymap_match = &self.matches[ix];
let style = theme.picker.item.style_for(mouse_state, selected);
@ -143,6 +143,6 @@ impl PickerDelegate for BaseKeymapSelectorDelegate {
.with_highlights(keymap_match.positions.clone())
.contained()
.with_style(style.container)
.into_element()
.into_any()
}
}

View file

@ -5,7 +5,7 @@ use std::{borrow::Cow, sync::Arc};
use db::kvp::KEY_VALUE_STORE;
use gpui::{
elements::{Flex, Label, ParentElement},
AppContext, Drawable, Element, Entity, Subscription, View, ViewContext,
AnyElement, AppContext, Element, Entity, Subscription, View, ViewContext,
};
use settings::{settings_file::SettingsFile, Settings};
@ -55,7 +55,7 @@ impl View for WelcomePage {
"WelcomePage"
}
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Element<Self> {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> AnyElement<Self> {
let self_handle = cx.handle();
let settings = cx.global::<Settings>();
let theme = settings.theme.clone();
@ -181,9 +181,9 @@ impl View for WelcomePage {
.contained()
.with_uniform_padding(10.)
.aligned()
.into_element(),
.into_any(),
)
.into_named_element("welcome page")
.into_any_named("welcome page")
}
}
@ -205,14 +205,14 @@ impl Item for WelcomePage {
_detail: Option<usize>,
style: &theme::Tab,
_cx: &gpui::AppContext,
) -> Element<T> {
) -> AnyElement<T> {
Flex::row()
.with_child(
Label::new("Welcome to Zed!", style.label.clone())
.aligned()
.contained(),
)
.into_element()
.into_any()
}
fn show_toolbar(&self) -> bool {