Return impl IntoElement from Render::render trait

This commit is contained in:
Nathan Sobo 2024-01-02 10:09:05 -07:00
parent 0f33775a91
commit 1b5c8b2b4a
84 changed files with 550 additions and 110 deletions

View file

@ -2,9 +2,9 @@ use collections::{HashMap, VecDeque};
use editor::{Editor, EditorEvent, MoveToEnd};
use futures::{channel::mpsc, StreamExt};
use gpui::{
actions, div, AnchorCorner, AnyElement, AppContext, Context, Element, EventEmitter,
FocusHandle, FocusableView, IntoElement, Model, ModelContext, ParentElement, Render, Styled,
Subscription, View, ViewContext, VisualContext, WeakModel, WindowContext,
actions, div, AnchorCorner, AnyElement, AppContext, Context, EventEmitter, FocusHandle,
FocusableView, IntoElement, Model, ModelContext, ParentElement, Render, Styled, Subscription,
View, ViewContext, VisualContext, WeakModel, WindowContext,
};
use language::{LanguageServerId, LanguageServerName};
use lsp::IoKind;
@ -595,9 +595,9 @@ fn log_contents(lines: &VecDeque<String>) -> String {
}
impl Render for LspLogView {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
self.editor
.update(cx, |editor, cx| editor.render(cx).into_any())
.update(cx, |editor, cx| editor.render(cx).into_any_element())
}
}
@ -708,7 +708,7 @@ impl ToolbarItemView for LspLogToolbarItemView {
}
impl Render for LspLogToolbarItemView {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let Some(log_view) = self.log_view.clone() else {
return div();
};

View file

@ -1,6 +1,6 @@
use editor::{scroll::autoscroll::Autoscroll, Anchor, Editor, ExcerptId};
use gpui::{
actions, canvas, div, rems, uniform_list, AnyElement, AppContext, AvailableSpace, Div, Element,
actions, canvas, div, rems, uniform_list, AnyElement, AppContext, AvailableSpace, Div,
EventEmitter, FocusHandle, FocusableView, Hsla, InteractiveElement, IntoElement, Model,
MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, Pixels, Render, Styled,
UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WindowContext,
@ -305,7 +305,7 @@ impl SyntaxTreeView {
}
impl Render for SyntaxTreeView {
fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> impl Element {
fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> impl IntoElement {
let settings = ThemeSettings::get_global(cx);
let line_height = cx
.text_style()
@ -505,7 +505,7 @@ fn format_node_range(node: Node) -> String {
}
impl Render for SyntaxTreeToolbarItemView {
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl Element {
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl IntoElement {
self.render_menu(cx)
.unwrap_or_else(|| popover_menu("Empty Syntax Tree"))
}