checkpoint

This commit is contained in:
Mikayla 2023-11-15 14:17:04 -08:00
parent 19c0b390d2
commit faf93aed4e
No known key found for this signature in database
4 changed files with 24 additions and 35 deletions

View file

@ -68,7 +68,7 @@ pub trait Action: std::fmt::Debug + 'static {
// Types become actions by satisfying a list of trait bounds. // Types become actions by satisfying a list of trait bounds.
impl<A> Action for A impl<A> Action for A
where where
A: for<'a> Deserialize<'a> + PartialEq + Clone + Default + std::fmt::Debug + 'static, A: for<'a> Deserialize<'a> + PartialEq + Default + Clone + std::fmt::Debug + 'static,
{ {
fn qualified_name() -> SharedString { fn qualified_name() -> SharedString {
let name = type_name::<A>(); let name = type_name::<A>();

View file

@ -9,7 +9,7 @@ use schemars::{
}; };
use serde::Deserialize; use serde::Deserialize;
use serde_json::Value; use serde_json::Value;
use util::asset_str; use util::{asset_str, ResultExt};
#[derive(Debug, Deserialize, Default, Clone, JsonSchema)] #[derive(Debug, Deserialize, Default, Clone, JsonSchema)]
#[serde(transparent)] #[serde(transparent)]
@ -86,9 +86,7 @@ impl KeymapFile {
"invalid binding value for keystroke {keystroke}, context {context:?}" "invalid binding value for keystroke {keystroke}, context {context:?}"
) )
}) })
// todo!() .log_err()
.ok()
// .log_err()
.map(|action| KeyBinding::load(&keystroke, action, context.as_deref())) .map(|action| KeyBinding::load(&keystroke, action, context.as_deref()))
}) })
.collect::<Result<Vec<_>>>()?; .collect::<Result<Vec<_>>>()?;

View file

@ -1398,6 +1398,7 @@ impl Pane {
.when_some(item.tab_tooltip_text(cx), |div, text| { .when_some(item.tab_tooltip_text(cx), |div, text| {
div.tooltip(move |_, cx| cx.build_view(|cx| TextTooltip::new(text.clone()))) div.tooltip(move |_, cx| cx.build_view(|cx| TextTooltip::new(text.clone())))
}) })
.on_click(move |v: &mut Self, e, cx| v.activate_item(ix, true, true, cx))
// .on_drag(move |pane, cx| pane.render_tab(ix, item.boxed_clone(), detail, cx)) // .on_drag(move |pane, cx| pane.render_tab(ix, item.boxed_clone(), detail, cx))
// .drag_over::<DraggedTab>(|d| d.bg(cx.theme().colors().element_drop_target)) // .drag_over::<DraggedTab>(|d| d.bg(cx.theme().colors().element_drop_target))
// .on_drop(|_view, state: View<DraggedTab>, cx| { // .on_drop(|_view, state: View<DraggedTab>, cx| {
@ -1430,32 +1431,22 @@ impl Pane {
.items_center() .items_center()
.gap_1() .gap_1()
.text_color(text_color) .text_color(text_color)
.children(if item.has_conflict(cx) { .children(
Some( item.has_conflict(cx)
IconElement::new(Icon::ExclamationTriangle) .then(|| {
.size(ui::IconSize::Small) IconElement::new(Icon::ExclamationTriangle)
.color(TextColor::Warning), .size(ui::IconSize::Small)
) .color(TextColor::Warning)
} else if item.is_dirty(cx) { })
Some( .or(item.is_dirty(cx).then(|| {
IconElement::new(Icon::ExclamationTriangle) IconElement::new(Icon::ExclamationTriangle)
.size(ui::IconSize::Small) .size(ui::IconSize::Small)
.color(TextColor::Info), .color(TextColor::Info)
) })),
} else { )
None .children((!close_right).then(|| close_icon()))
})
.children(if !close_right {
Some(close_icon())
} else {
None
})
.child(label) .child(label)
.children(if close_right { .children(close_right.then(|| close_icon())),
Some(close_icon())
} else {
None
}),
) )
} }

View file

@ -36,11 +36,11 @@ use futures::{
Future, FutureExt, StreamExt, Future, FutureExt, StreamExt,
}; };
use gpui::{ use gpui::{
actions, div, point, prelude::*, rems, size, Action, AnyModel, AnyView, AnyWeakView, actions, div, point, prelude::*, register_action, rems, size, Action, AnyModel, AnyView,
AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity, EntityId, AnyWeakView, AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity,
EventEmitter, GlobalPixels, KeyContext, Model, ModelContext, ParentComponent, Point, Render, EntityId, EventEmitter, GlobalPixels, KeyContext, Model, ModelContext, ParentComponent, Point,
Size, Styled, Subscription, Task, View, ViewContext, WeakView, WindowBounds, WindowContext, Render, Size, Styled, Subscription, Task, View, ViewContext, WeakView, WindowBounds,
WindowHandle, WindowOptions, WindowContext, WindowHandle, WindowOptions,
}; };
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem}; use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
use itertools::Itertools; use itertools::Itertools;