Merge branch 'main' into search2

This commit is contained in:
Piotr Osiewicz 2023-11-20 19:23:35 +01:00
commit d60855b06d
108 changed files with 2988 additions and 1900 deletions

View file

@ -42,9 +42,9 @@ use gpui::{
actions, div, point, prelude::*, px, relative, rems, size, uniform_list, Action, AnyElement,
AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Component, Context,
EventEmitter, FocusHandle, FocusableView, FontFeatures, FontStyle, FontWeight, HighlightStyle,
Hsla, InputHandler, KeyContext, Model, MouseButton, ParentComponent, Pixels, Render, Styled,
Subscription, Task, TextStyle, UniformListScrollHandle, View, ViewContext, VisualContext,
WeakView, WindowContext,
Hsla, InputHandler, KeyContext, Model, MouseButton, ParentElement, Pixels, Render,
SharedString, Styled, Subscription, Task, TextStyle, UniformListScrollHandle, View,
ViewContext, VisualContext, WeakView, WindowContext,
};
use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState};
@ -1580,7 +1580,8 @@ impl CodeActionsMenu {
)
.map(|task| task.detach_and_log_err(cx));
})
.child(action.lsp_action.title.clone())
// TASK: It would be good to make lsp_action.title a SharedString to avoid allocating here.
.child(SharedString::from(action.lsp_action.title.clone()))
})
.collect()
},
@ -1595,7 +1596,7 @@ impl CodeActionsMenu {
.max_by_key(|(_, action)| action.lsp_action.title.chars().count())
.map(|(ix, _)| ix),
)
.render();
.render_into_any();
if self.deployed_from_indicator {
*cursor_position.column_mut() = 0;
@ -4354,19 +4355,19 @@ impl Editor {
style: &EditorStyle,
is_active: bool,
cx: &mut ViewContext<Self>,
) -> Option<AnyElement<Self>> {
) -> Option<IconButton<Self>> {
if self.available_code_actions.is_some() {
Some(
IconButton::new("code_actions_indicator", ui::Icon::Bolt)
.on_click(|editor: &mut Editor, cx| {
IconButton::new("code_actions_indicator", ui::Icon::Bolt).on_click(
|editor: &mut Editor, cx| {
editor.toggle_code_actions(
&ToggleCodeActions {
deployed_from_indicator: true,
},
cx,
);
})
.render(),
},
),
)
} else {
None
@ -4381,7 +4382,7 @@ impl Editor {
line_height: Pixels,
gutter_margin: Pixels,
cx: &mut ViewContext<Self>,
) -> Vec<Option<AnyElement<Self>>> {
) -> Vec<Option<IconButton<Self>>> {
fold_data
.iter()
.enumerate()
@ -4403,7 +4404,6 @@ impl Editor {
}
})
.color(ui::TextColor::Muted)
.render()
})
})
.flatten()
@ -7794,7 +7794,7 @@ impl Editor {
cx.editor_style.diagnostic_style.clone(),
},
)))
.render()
.render_into_any()
}
}),
disposition: BlockDisposition::Below,
@ -9383,7 +9383,7 @@ impl FocusableView for Editor {
}
}
impl Render for Editor {
impl Render<Self> for Editor {
type Element = EditorElement;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
@ -10001,7 +10001,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()
.render_into_any()
})
}