Attempt to return impl Element from render. 3 errors.

This commit is contained in:
Nathan Sobo 2023-12-30 08:58:07 -07:00 committed by Piotr Osiewicz
parent 5f2bb82ef3
commit 51d1d92d66
86 changed files with 230 additions and 443 deletions

View file

@ -1,10 +1,10 @@
use collections::{HashMap, VecDeque};
use editor::{Editor, EditorElement, EditorEvent, MoveToEnd};
use editor::{Editor, EditorEvent, MoveToEnd};
use futures::{channel::mpsc, StreamExt};
use gpui::{
actions, div, AnchorCorner, AnyElement, AppContext, Context, Div, EventEmitter, FocusHandle,
FocusableView, IntoElement, Model, ModelContext, ParentElement, Render, Styled, Subscription,
View, ViewContext, VisualContext, WeakModel, WindowContext,
actions, div, AnchorCorner, AnyElement, AppContext, Context, Element, EventEmitter,
FocusHandle, FocusableView, IntoElement, Model, ModelContext, ParentElement, Render, Styled,
Subscription, View, ViewContext, VisualContext, WeakModel, WindowContext,
};
use language::{LanguageServerId, LanguageServerName};
use lsp::IoKind;
@ -595,10 +595,10 @@ fn log_contents(lines: &VecDeque<String>) -> String {
}
impl Render for LspLogView {
type Element = EditorElement;
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
let _x = self.editor.update(cx, |editor, cx| editor.render(cx));
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
self.editor.update(cx, |editor, cx| editor.render(cx))
div()
}
}
@ -709,9 +709,7 @@ impl ToolbarItemView for LspLogToolbarItemView {
}
impl Render for LspLogToolbarItemView {
type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
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,
actions, canvas, div, rems, uniform_list, AnyElement, AppContext, AvailableSpace, Div, Element,
EventEmitter, FocusHandle, FocusableView, Hsla, InteractiveElement, IntoElement, Model,
MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, Pixels, Render, Styled,
UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WindowContext,
@ -305,9 +305,7 @@ impl SyntaxTreeView {
}
impl Render for SyntaxTreeView {
type Element = Div;
fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> Self::Element {
fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> impl Element {
let settings = ThemeSettings::get_global(cx);
let line_height = cx
.text_style()
@ -507,9 +505,7 @@ fn format_node_range(node: Node) -> String {
}
impl Render for SyntaxTreeToolbarItemView {
type Element = PopoverMenu<ContextMenu>;
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> PopoverMenu<ContextMenu> {
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl Element {
self.render_menu(cx)
.unwrap_or_else(|| popover_menu("Empty Syntax Tree"))
}