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::path::Path;
use fuzzy::StringMatch;
use gpui::{
elements::{Label, LabelStyle},
Drawable, Element, View,
Element, AnyElement, View,
};
use workspace::WorkspaceLocation;
@ -42,10 +42,10 @@ impl HighlightedText {
}
}
pub fn render<V: View>(self, style: impl Into<LabelStyle>) -> Element<V> {
pub fn render<V: View>(self, style: impl Into<LabelStyle>) -> AnyElement<V> {
Label::new(self.text, style)
.with_highlights(self.highlight_positions)
.into_element()
.into_any()
}
}

View file

@ -5,7 +5,7 @@ use gpui::{
actions,
anyhow::Result,
elements::{Flex, ParentElement},
AppContext, Drawable, Element, Task, ViewContext,
AnyElement, AppContext, Element, Task, ViewContext,
};
use highlighted_workspace_location::HighlightedWorkspaceLocation;
use ordered_float::OrderedFloat;
@ -156,7 +156,7 @@ impl PickerDelegate for RecentProjectsDelegate {
mouse_state: &mut gpui::MouseState,
selected: bool,
cx: &gpui::AppContext,
) -> Element<Picker<Self>> {
) -> AnyElement<Picker<Self>> {
let settings = cx.global::<Settings>();
let string_match = &self.matches[ix];
let style = settings.theme.picker.item.style_for(mouse_state, selected);
@ -177,6 +177,6 @@ impl PickerDelegate for RecentProjectsDelegate {
.flex(1., false)
.contained()
.with_style(style.container)
.into_named_element("match")
.into_any_named("match")
}
}