Reorganize element-related traits
This commit is contained in:
parent
ca1d9dd0e5
commit
c23f17ee0b
42 changed files with 190 additions and 265 deletions
|
@ -40,9 +40,9 @@ use fuzzy::{StringMatch, StringMatchCandidate};
|
|||
use git::diff_hunk_to_display;
|
||||
use gpui::{
|
||||
actions, div, point, prelude::*, px, relative, rems, size, uniform_list, Action, AnyElement,
|
||||
AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Component, Context,
|
||||
AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Context,
|
||||
EventEmitter, FocusHandle, FocusableView, FontFeatures, FontStyle, FontWeight, HighlightStyle,
|
||||
Hsla, InputHandler, KeyContext, Model, MouseButton, ParentElement, Pixels, Render,
|
||||
Hsla, InputHandler, KeyContext, Model, MouseButton, ParentElement, Pixels, Render, RenderOnce,
|
||||
SharedString, Styled, Subscription, Task, TextStyle, UniformListScrollHandle, View,
|
||||
ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext,
|
||||
};
|
||||
|
@ -1373,7 +1373,7 @@ impl CompletionsMenu {
|
|||
.track_scroll(self.scroll_handle.clone())
|
||||
.with_width_from_item(widest_completion_ix);
|
||||
|
||||
list.render_into_any()
|
||||
list.into_any_element()
|
||||
// todo!("multiline documentation")
|
||||
// enum MultiLineDocumentation {}
|
||||
|
||||
|
@ -1596,7 +1596,7 @@ impl CodeActionsMenu {
|
|||
.max_by_key(|(_, action)| action.lsp_action.title.chars().count())
|
||||
.map(|(ix, _)| ix),
|
||||
)
|
||||
.render_into_any();
|
||||
.into_any_element();
|
||||
|
||||
if self.deployed_from_indicator {
|
||||
*cursor_position.column_mut() = 0;
|
||||
|
@ -7796,7 +7796,7 @@ impl Editor {
|
|||
.clone(),
|
||||
},
|
||||
))
|
||||
.render_into_any()
|
||||
.into_any_element()
|
||||
}
|
||||
}),
|
||||
disposition: BlockDisposition::Below,
|
||||
|
@ -10005,7 +10005,7 @@ pub fn diagnostic_block_renderer(diagnostic: Diagnostic, is_valid: bool) -> Rend
|
|||
cx.write_to_clipboard(ClipboardItem::new(message.clone()));
|
||||
}))
|
||||
.tooltip(|cx| Tooltip::text("Copy diagnostic message", cx))
|
||||
.render_into_any()
|
||||
.into_any_element()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ use anyhow::Result;
|
|||
use collections::{BTreeMap, HashMap};
|
||||
use gpui::{
|
||||
div, point, px, relative, size, transparent_black, Action, AnyElement, AvailableSpace,
|
||||
BorrowWindow, Bounds, Component, ContentMask, Corners, DispatchPhase, Edges, Element,
|
||||
ElementId, ElementInputHandler, Entity, EntityId, Hsla, InteractiveElement, LineLayout,
|
||||
BorrowWindow, Bounds, ContentMask, Corners, DispatchPhase, Edges, Element, ElementId,
|
||||
ElementInputHandler, Entity, EntityId, Hsla, InteractiveElement, IntoElement, LineLayout,
|
||||
MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, RenderOnce,
|
||||
ScrollWheelEvent, ShapedLine, SharedString, Size, StatefulInteractiveElement, Style, Styled,
|
||||
TextRun, TextStyle, View, ViewContext, WeakView, WindowContext, WrappedLine,
|
||||
|
@ -663,7 +663,7 @@ impl EditorElement {
|
|||
|
||||
for (ix, fold_indicator) in layout.fold_indicators.drain(..).enumerate() {
|
||||
if let Some(mut fold_indicator) = fold_indicator {
|
||||
let mut fold_indicator = fold_indicator.render_into_any();
|
||||
let mut fold_indicator = fold_indicator.into_any_element();
|
||||
let available_space = size(
|
||||
AvailableSpace::MinContent,
|
||||
AvailableSpace::Definite(line_height * 0.55),
|
||||
|
@ -684,7 +684,7 @@ impl EditorElement {
|
|||
}
|
||||
|
||||
if let Some(indicator) = layout.code_actions_indicator.take() {
|
||||
let mut button = indicator.button.render_into_any();
|
||||
let mut button = indicator.button.into_any_element();
|
||||
let available_space = size(
|
||||
AvailableSpace::MinContent,
|
||||
AvailableSpace::Definite(line_height),
|
||||
|
@ -2653,14 +2653,14 @@ impl Element for EditorElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for EditorElement {
|
||||
impl IntoElement for EditorElement {
|
||||
type Element = Self;
|
||||
|
||||
fn element_id(&self) -> Option<gpui::ElementId> {
|
||||
self.editor.element_id()
|
||||
}
|
||||
|
||||
fn render_once(self) -> Self::Element {
|
||||
fn into_element(self) -> Self::Element {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue