From faf93aed4e8a464017fabd0633d9950e13d26a8c Mon Sep 17 00:00:00 2001 From: Mikayla Date: Wed, 15 Nov 2023 14:17:04 -0800 Subject: [PATCH] checkpoint --- crates/gpui2/src/action.rs | 2 +- crates/settings2/src/keymap_file.rs | 6 ++--- crates/workspace2/src/pane.rs | 41 +++++++++++------------------ crates/workspace2/src/workspace2.rs | 10 +++---- 4 files changed, 24 insertions(+), 35 deletions(-) diff --git a/crates/gpui2/src/action.rs b/crates/gpui2/src/action.rs index dbb510b1c8..a81bcfcdbc 100644 --- a/crates/gpui2/src/action.rs +++ b/crates/gpui2/src/action.rs @@ -68,7 +68,7 @@ pub trait Action: std::fmt::Debug + 'static { // Types become actions by satisfying a list of trait bounds. impl Action for A 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 { let name = type_name::(); diff --git a/crates/settings2/src/keymap_file.rs b/crates/settings2/src/keymap_file.rs index 2b57af0fdb..9f279864ee 100644 --- a/crates/settings2/src/keymap_file.rs +++ b/crates/settings2/src/keymap_file.rs @@ -9,7 +9,7 @@ use schemars::{ }; use serde::Deserialize; use serde_json::Value; -use util::asset_str; +use util::{asset_str, ResultExt}; #[derive(Debug, Deserialize, Default, Clone, JsonSchema)] #[serde(transparent)] @@ -86,9 +86,7 @@ impl KeymapFile { "invalid binding value for keystroke {keystroke}, context {context:?}" ) }) - // todo!() - .ok() - // .log_err() + .log_err() .map(|action| KeyBinding::load(&keystroke, action, context.as_deref())) }) .collect::>>()?; diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs index 668ce2f207..7f3658260c 100644 --- a/crates/workspace2/src/pane.rs +++ b/crates/workspace2/src/pane.rs @@ -1398,6 +1398,7 @@ impl Pane { .when_some(item.tab_tooltip_text(cx), |div, text| { 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)) // .drag_over::(|d| d.bg(cx.theme().colors().element_drop_target)) // .on_drop(|_view, state: View, cx| { @@ -1430,32 +1431,22 @@ impl Pane { .items_center() .gap_1() .text_color(text_color) - .children(if item.has_conflict(cx) { - Some( - IconElement::new(Icon::ExclamationTriangle) - .size(ui::IconSize::Small) - .color(TextColor::Warning), - ) - } else if item.is_dirty(cx) { - Some( - IconElement::new(Icon::ExclamationTriangle) - .size(ui::IconSize::Small) - .color(TextColor::Info), - ) - } else { - None - }) - .children(if !close_right { - Some(close_icon()) - } else { - None - }) + .children( + item.has_conflict(cx) + .then(|| { + IconElement::new(Icon::ExclamationTriangle) + .size(ui::IconSize::Small) + .color(TextColor::Warning) + }) + .or(item.is_dirty(cx).then(|| { + IconElement::new(Icon::ExclamationTriangle) + .size(ui::IconSize::Small) + .color(TextColor::Info) + })), + ) + .children((!close_right).then(|| close_icon())) .child(label) - .children(if close_right { - Some(close_icon()) - } else { - None - }), + .children(close_right.then(|| close_icon())), ) } diff --git a/crates/workspace2/src/workspace2.rs b/crates/workspace2/src/workspace2.rs index 6c2d0c0ede..6a26fbdb5c 100644 --- a/crates/workspace2/src/workspace2.rs +++ b/crates/workspace2/src/workspace2.rs @@ -36,11 +36,11 @@ use futures::{ Future, FutureExt, StreamExt, }; use gpui::{ - actions, div, point, prelude::*, rems, size, Action, AnyModel, AnyView, AnyWeakView, - AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity, EntityId, - EventEmitter, GlobalPixels, KeyContext, Model, ModelContext, ParentComponent, Point, Render, - Size, Styled, Subscription, Task, View, ViewContext, WeakView, WindowBounds, WindowContext, - WindowHandle, WindowOptions, + actions, div, point, prelude::*, register_action, rems, size, Action, AnyModel, AnyView, + AnyWeakView, AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity, + EntityId, EventEmitter, GlobalPixels, KeyContext, Model, ModelContext, ParentComponent, Point, + Render, Size, Styled, Subscription, Task, View, ViewContext, WeakView, WindowBounds, + WindowContext, WindowHandle, WindowOptions, }; use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem}; use itertools::Itertools;