Refine naming of element-related types and traits
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
03619dfa55
commit
fe492eacbf
93 changed files with 661 additions and 656 deletions
|
@ -92,7 +92,7 @@ impl View for BufferSearchBar {
|
|||
}
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
let editor_container = if self.query_contains_error {
|
||||
theme.search.invalid_editor
|
||||
|
@ -178,7 +178,7 @@ impl View for BufferSearchBar {
|
|||
.with_child(self.render_close_button(&theme.search, cx))
|
||||
.contained()
|
||||
.with_style(theme.search.container)
|
||||
.into_named_element("search bar")
|
||||
.into_any_named("search bar")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ impl BufferSearchBar {
|
|||
icon: &'static str,
|
||||
option: SearchOption,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<Element<Self>> {
|
||||
) -> Option<AnyElement<Self>> {
|
||||
if !option_supported {
|
||||
return None;
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ impl BufferSearchBar {
|
|||
tooltip_style,
|
||||
cx,
|
||||
)
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ impl BufferSearchBar {
|
|||
icon: &'static str,
|
||||
direction: Direction,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
) -> AnyElement<Self> {
|
||||
let action: Box<dyn Action>;
|
||||
let tooltip;
|
||||
match direction {
|
||||
|
@ -397,14 +397,14 @@ impl BufferSearchBar {
|
|||
tooltip_style,
|
||||
cx,
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn render_close_button(
|
||||
&self,
|
||||
theme: &theme::Search,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
) -> AnyElement<Self> {
|
||||
let action = Box::new(Dismiss);
|
||||
let tooltip = "Dismiss Buffer Search";
|
||||
let tooltip_style = cx.global::<Settings>().theme.tooltip.clone();
|
||||
|
@ -428,7 +428,7 @@ impl BufferSearchBar {
|
|||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.with_tooltip::<CloseButton>(0, tooltip.to_string(), Some(action), tooltip_style, cx)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn deploy(pane: &mut Pane, action: &Deploy, cx: &mut ViewContext<Pane>) {
|
||||
|
|
|
@ -12,7 +12,7 @@ use gpui::{
|
|||
actions,
|
||||
elements::*,
|
||||
platform::{CursorStyle, MouseButton},
|
||||
Action, AnyViewHandle, AppContext, Element, Entity, ModelContext, ModelHandle, Subscription,
|
||||
Action, AnyElement, AnyViewHandle, AppContext, Entity, ModelContext, ModelHandle, Subscription,
|
||||
Task, View, ViewContext, ViewHandle, WeakModelHandle, WeakViewHandle,
|
||||
};
|
||||
use menu::Confirm;
|
||||
|
@ -178,7 +178,7 @@ impl View for ProjectSearchView {
|
|||
"ProjectSearchView"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let model = &self.model.read(cx);
|
||||
if model.match_ranges.is_empty() {
|
||||
enum Status {}
|
||||
|
@ -201,11 +201,11 @@ impl View for ProjectSearchView {
|
|||
.on_down(MouseButton::Left, |_, _, cx| {
|
||||
cx.focus_parent_view();
|
||||
})
|
||||
.into_named_element("project search view")
|
||||
.into_any_named("project search view")
|
||||
} else {
|
||||
ChildView::new(&self.results_editor, cx)
|
||||
.flex(1., true)
|
||||
.into_named_element("project search view")
|
||||
.into_any_named("project search view")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ impl Item for ProjectSearchView {
|
|||
_detail: Option<usize>,
|
||||
tab_theme: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> Element<T> {
|
||||
) -> AnyElement<T> {
|
||||
Flex::row()
|
||||
.with_child(
|
||||
Svg::new("icons/magnifying_glass_12.svg")
|
||||
|
@ -269,7 +269,7 @@ impl Item for ProjectSearchView {
|
|||
|
||||
Label::new(query_text, tab_theme.label.clone()).aligned()
|
||||
}))
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn for_each_project_item(&self, cx: &AppContext, f: &mut dyn FnMut(usize, &dyn project::Item)) {
|
||||
|
@ -748,7 +748,7 @@ impl ProjectSearchBar {
|
|||
icon: &'static str,
|
||||
direction: Direction,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
) -> AnyElement<Self> {
|
||||
let action: Box<dyn Action>;
|
||||
let tooltip;
|
||||
match direction {
|
||||
|
@ -787,7 +787,7 @@ impl ProjectSearchBar {
|
|||
tooltip_style,
|
||||
cx,
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn render_option_button(
|
||||
|
@ -795,7 +795,7 @@ impl ProjectSearchBar {
|
|||
icon: &'static str,
|
||||
option: SearchOption,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
) -> AnyElement<Self> {
|
||||
let tooltip_style = cx.global::<Settings>().theme.tooltip.clone();
|
||||
let is_active = self.is_option_enabled(option, cx);
|
||||
MouseEventHandler::<Self, _>::new(option as usize, cx, |state, cx| {
|
||||
|
@ -820,7 +820,7 @@ impl ProjectSearchBar {
|
|||
tooltip_style,
|
||||
cx,
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn is_option_enabled(&self, option: SearchOption, cx: &AppContext) -> bool {
|
||||
|
@ -846,7 +846,7 @@ impl View for ProjectSearchBar {
|
|||
"ProjectSearchBar"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
if let Some(search) = self.active_project_search.as_ref() {
|
||||
let search = search.read(cx);
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
@ -908,9 +908,9 @@ impl View for ProjectSearchBar {
|
|||
.with_style(theme.search.container)
|
||||
.aligned()
|
||||
.left()
|
||||
.into_named_element("project search")
|
||||
.into_any_named("project search")
|
||||
} else {
|
||||
Empty::new().into_element()
|
||||
Empty::new().into_any()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue