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

@ -13,9 +13,9 @@ use editor::{
};
use futures::future::try_join_all;
use gpui::{
actions, div, AnyElement, AnyView, AppContext, Component, Context, Div, EventEmitter,
FocusEvent, FocusHandle, Focusable, FocusableComponent, FocusableView, InteractiveComponent,
Model, ParentComponent, Render, SharedString, Styled, Subscription, Task, View, ViewContext,
actions, div, AnyElement, AnyView, AppContext, Context, Div, EventEmitter, FocusEvent,
FocusHandle, Focusable, FocusableElement, FocusableView, InteractiveElement, Model,
ParentElement, Render, RenderOnce, SharedString, Styled, Subscription, Task, View, ViewContext,
VisualContext, WeakView,
};
use language::{
@ -90,7 +90,7 @@ struct DiagnosticGroupState {
impl EventEmitter<ItemEvent> for ProjectDiagnosticsEditor {}
impl Render for ProjectDiagnosticsEditor {
impl Render<Self> for ProjectDiagnosticsEditor {
type Element = Focusable<Self, Div<Self>>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
@ -792,13 +792,15 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
.when_some(diagnostic.code.as_ref(), |stack, code| {
stack.child(Label::new(code.clone()))
})
.render()
.render_into_any()
})
}
pub(crate) fn render_summary<T: 'static>(summary: &DiagnosticSummary) -> AnyElement<T> {
if summary.error_count == 0 && summary.warning_count == 0 {
Label::new("No problems").render()
let label = Label::new("No problems");
label.render_into_any()
//.render()
} else {
h_stack()
.bg(gpui::red())
@ -806,7 +808,7 @@ pub(crate) fn render_summary<T: 'static>(summary: &DiagnosticSummary) -> AnyElem
.child(Label::new(summary.error_count.to_string()))
.child(IconElement::new(Icon::ExclamationTriangle))
.child(Label::new(summary.warning_count.to_string()))
.render()
.render_into_any()
}
}

View file

@ -1,8 +1,8 @@
use collections::HashSet;
use editor::{Editor, GoToDiagnostic};
use gpui::{
rems, Div, EventEmitter, InteractiveComponent, ParentComponent, Render, Stateful,
StatefulInteractiveComponent, Styled, Subscription, View, ViewContext, WeakView,
rems, Div, EventEmitter, InteractiveElement, ParentElement, Render, Stateful,
StatefulInteractiveElement, Styled, Subscription, View, ViewContext, WeakView,
};
use language::Diagnostic;
use lsp::LanguageServerId;
@ -21,7 +21,7 @@ pub struct DiagnosticIndicator {
_observe_active_editor: Option<Subscription>,
}
impl Render for DiagnosticIndicator {
impl Render<Self> for DiagnosticIndicator {
type Element = Stateful<Self, Div<Self>>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {

View file

@ -1,5 +1,5 @@
use crate::ProjectDiagnosticsEditor;
use gpui::{div, Div, EventEmitter, ParentComponent, Render, ViewContext, WeakView};
use gpui::{div, Div, EventEmitter, ParentElement, Render, ViewContext, WeakView};
use ui::{Icon, IconButton, Tooltip};
use workspace::{item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView};
@ -7,7 +7,7 @@ pub struct ToolbarControls {
editor: Option<WeakView<ProjectDiagnosticsEditor>>,
}
impl Render for ToolbarControls {
impl Render<Self> for ToolbarControls {
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {