Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Merge branch 'main' into saving-2
Mikayla1693718637d2
diff --cc crates/workspace2/src/dock.rsindex 64da42cea7a,f62633e439f..9603875aed3--- a/crates/workspace2/src/dock.rs+++ b/crates/workspace2/src/dock.rs@@@ -416,6 -416,32 +416,14 @@@ impl Dockcx.notify();}}++ pub fn toggle_action(&self) -> Box<dyn Action> {+ match self.position {+ DockPosition::Left => crate::ToggleLeftDock.boxed_clone(),+ DockPosition::Bottom => crate::ToggleBottomDock.boxed_clone(),+ DockPosition::Right => crate::ToggleRightDock.boxed_clone(),+ }+ }-- // pub fn render_placeholder(&self, cx: &WindowContext) -> AnyElement<Workspace> {- // todo!()- // if let Some(active_entry) = self.visible_entry() {- // Empty::new()- // .into_any()- // .contained()- // .with_style(self.style(cx))- // .resizable::<WorkspaceBounds>(- // self.position.to_resize_handle_side(),- // active_entry.panel.size(cx),- // |_, _, _| {},- // )- // .into_any()- // } else {- // Empty::new().into_any()- // }- // }}impl Render for Dock {diff --cc crates/workspace2/src/workspace2.rsindex c7a27848cea,dc69280c1eb..08d248f6f2a--- a/crates/workspace2/src/workspace2.rs+++ b/crates/workspace2/src/workspace2.rs@@@ -31,10 -31,9 +31,10 @@@ use futures::use gpui::{actions, div, point, size, Action, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext,AsyncWindowContext, Bounds, Context, Div, Entity, EntityId, EventEmitter, FocusHandle,- FocusableView, GlobalPixels, InteractiveComponent, KeyContext, Model, ModelContext,- ParentComponent, PathPromptOptions, Point, PromptLevel, Render, Size, Styled, Subscription,- Task, View, ViewContext, VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle,- WindowOptions,+ FocusableView, GlobalPixels, InteractiveComponent, KeyContext, ManagedView, Model,- ModelContext, ParentComponent, Point, Render, Size, Styled, Subscription, Task, View,- ViewContext, VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle, WindowOptions,++ ModelContext, ParentComponent, PathPromptOptions, Point, PromptLevel, Render, Size, Styled,++ Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowBounds, WindowContext,++ WindowHandle, WindowOptions,};use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};use itertools::Itertools;@@@ -3202,40 -3212,53 +3202,41 @@@ impl Workspace})}- fn actions(div: Div<Self>) -> Div<Self> {- div.on_action(Self::open)+ fn actions(&self, div: Div<Self>) -> Div<Self> {+ self.add_workspace_actions_listeners(div)+ // cx.add_async_action(Workspace::open);// cx.add_async_action(Workspace::follow_next_collaborator);// cx.add_async_action(Workspace::close);- // cx.add_async_action(Workspace::close_inactive_items_and_panes);- // cx.add_async_action(Workspace::close_all_items_and_panes);+ .on_action(Self::close_inactive_items_and_panes)+ .on_action(Self::close_all_items_and_panes)// cx.add_global_action(Workspace::close_global);// cx.add_global_action(restart);- // cx.add_async_action(Workspace::save_all);- // cx.add_action(Workspace::add_folder_to_project);- // cx.add_action(- // |workspace: &mut Workspace, _: &Unfollow, cx: &mut ViewContext<Workspace>| {- // let pane = workspace.active_pane().clone();- // workspace.unfollow(&pane, cx);- // },- // );- // cx.add_action(- // |workspace: &mut Workspace, action: &Save, cx: &mut ViewContext<Workspace>| {- // workspace- // .save_active_item(action.save_intent.unwrap_or(SaveIntent::Save), cx)- // .detach_and_log_err(cx);- // },- // );- // cx.add_action(- // |workspace: &mut Workspace, _: &SaveAs, cx: &mut ViewContext<Workspace>| {- // workspace- // .save_active_item(SaveIntent::SaveAs, cx)- // .detach_and_log_err(cx);- // },- // );- // cx.add_action(|workspace: &mut Workspace, _: &ActivatePreviousPane, cx| {- // workspace.activate_previous_pane(cx)- // });- // cx.add_action(|workspace: &mut Workspace, _: &ActivateNextPane, cx| {- // workspace.activate_next_pane(cx)- // });- // cx.add_action(- // |workspace: &mut Workspace, action: &ActivatePaneInDirection, cx| {- // workspace.activate_pane_in_direction(action.0, cx)- // },- // );- // cx.add_action(- // |workspace: &mut Workspace, action: &SwapPaneInDirection, cx| {- // workspace.swap_pane_in_direction(action.0, cx)- // },- // );+ .on_action(Self::save_all)+ .on_action(Self::add_folder_to_project)+ .on_action(|workspace, _: &Unfollow, cx| {+ let pane = workspace.active_pane().clone();+ workspace.unfollow(&pane, cx);+ })+ .on_action(|workspace, action: &Save, cx| {+ workspace+ .save_active_item(action.save_intent.unwrap_or(SaveIntent::Save), cx)+ .detach_and_log_err(cx);+ })+ .on_action(|workspace, _: &SaveAs, cx| {+ workspace+ .save_active_item(SaveIntent::SaveAs, cx)+ .detach_and_log_err(cx);+ })+ .on_action(|workspace, _: &ActivatePreviousPane, cx| {+ workspace.activate_previous_pane(cx)+ })+ .on_action(|workspace, _: &ActivateNextPane, cx| workspace.activate_next_pane(cx))+ .on_action(|workspace, action: &ActivatePaneInDirection, cx| {+ workspace.activate_pane_in_direction(action.0, cx)+ })+ .on_action(|workspace, action: &SwapPaneInDirection, cx| {+ workspace.swap_pane_in_direction(action.0, cx)+ }).on_action(|this, e: &ToggleLeftDock, cx| {this.toggle_dock(DockPosition::Left, cx);})