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

@ -41,7 +41,7 @@ use gpui::{
keymap_matcher::KeymapContext,
platform::{CursorStyle, MouseButton},
serde_json::{self, json},
AnyViewHandle, AppContext, AsyncAppContext, ClipboardItem, Drawable, Element, Entity,
AnyElement, AnyViewHandle, AppContext, AsyncAppContext, ClipboardItem, Element, Entity,
ModelHandle, Subscription, Task, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
};
use highlight_matching_bracket::refresh_matching_bracket_highlights;
@ -725,7 +725,7 @@ impl ContextMenu {
cursor_position: DisplayPoint,
style: EditorStyle,
cx: &mut ViewContext<Editor>,
) -> (DisplayPoint, Element<Editor>) {
) -> (DisplayPoint, AnyElement<Editor>) {
match self {
ContextMenu::Completions(menu) => (cursor_position, menu.render(style, cx)),
ContextMenu::CodeActions(menu) => menu.render(cursor_position, style, cx),
@ -777,7 +777,7 @@ impl CompletionsMenu {
!self.matches.is_empty()
}
fn render(&self, style: EditorStyle, cx: &mut ViewContext<Editor>) -> Element<Editor> {
fn render(&self, style: EditorStyle, cx: &mut ViewContext<Editor>) -> AnyElement<Editor> {
enum CompletionTag {}
let completions = self.completions.clone();
@ -827,7 +827,7 @@ impl CompletionsMenu {
item_ix: Some(item_ix),
});
})
.into_element(),
.into_any(),
);
}
},
@ -847,7 +847,7 @@ impl CompletionsMenu {
)
.contained()
.with_style(container_style)
.into_element()
.into_any()
}
pub async fn filter(&mut self, query: Option<&str>, executor: Arc<executor::Background>) {
@ -953,7 +953,7 @@ impl CodeActionsMenu {
mut cursor_position: DisplayPoint,
style: EditorStyle,
cx: &mut ViewContext<Editor>,
) -> (DisplayPoint, Element<Editor>) {
) -> (DisplayPoint, AnyElement<Editor>) {
enum ActionTag {}
let container_style = style.autocomplete.container;
@ -988,7 +988,7 @@ impl CodeActionsMenu {
item_ix: Some(item_ix),
});
})
.into_element(),
.into_any(),
);
}
},
@ -1002,7 +1002,7 @@ impl CodeActionsMenu {
)
.contained()
.with_style(container_style)
.into_element();
.into_any();
if self.deployed_from_indicator {
*cursor_position.column_mut() = 0;
@ -3129,7 +3129,7 @@ impl Editor {
style: &EditorStyle,
active: bool,
cx: &mut ViewContext<Self>,
) -> Option<Element<Self>> {
) -> Option<AnyElement<Self>> {
if self.available_code_actions.is_some() {
enum CodeActions {}
Some(
@ -3144,7 +3144,7 @@ impl Editor {
deployed_from_indicator: true,
});
})
.into_element(),
.into_any(),
)
} else {
None
@ -3159,7 +3159,7 @@ impl Editor {
line_height: f32,
gutter_margin: f32,
cx: &mut ViewContext<Self>,
) -> Vec<Option<Element<Self>>> {
) -> Vec<Option<AnyElement<Self>>> {
enum FoldIndicators {}
let style = style.folds.clone();
@ -3207,7 +3207,7 @@ impl Editor {
});
}
})
.into_element()
.into_any()
})
})
.flatten()
@ -3226,7 +3226,7 @@ impl Editor {
cursor_position: DisplayPoint,
style: EditorStyle,
cx: &mut ViewContext<Editor>,
) -> Option<(DisplayPoint, Element<Editor>)> {
) -> Option<(DisplayPoint, AnyElement<Editor>)> {
self.context_menu
.as_ref()
.map(|menu| menu.render(cursor_position, style, cx))
@ -5889,7 +5889,7 @@ impl Editor {
ChildView::new(&editor, cx)
.contained()
.with_padding_left(cx.anchor_x)
.into_element()
.into_any()
}
}),
disposition: BlockDisposition::Below,
@ -7003,7 +7003,7 @@ impl Entity for Editor {
}
impl View for Editor {
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
let style = self.style(cx);
let font_changed = self.display_map.update(cx, |map, cx| {
map.set_fold_ellipses_color(style.folds.ellipses.text_color);
@ -7020,7 +7020,7 @@ impl View for Editor {
Stack::new()
.with_child(EditorElement::new(style.clone()))
.with_child(ChildView::new(&self.mouse_context_menu, cx))
.into_element()
.into_any()
}
fn ui_name() -> &'static str {
@ -7496,7 +7496,7 @@ pub fn diagnostic_block_renderer(diagnostic: Diagnostic, is_valid: bool) -> Rend
}))
.aligned()
.left()
.into_element()
.into_any()
})
}