Checkpoint

This commit is contained in:
Nathan Sobo 2023-11-14 01:15:48 -07:00
parent ce30a689a0
commit 27fb381cca
82 changed files with 661 additions and 1907 deletions

View file

@ -36,12 +36,11 @@ use futures::{
Future, FutureExt, StreamExt,
};
use gpui::{
actions, div, point, rems, size, Action, AnyModel, AnyView, AnyWeakView, AppContext,
AsyncAppContext, AsyncWindowContext, Bounds, Component, Div, Entity, EntityId, EventEmitter,
FocusHandle, GlobalPixels, KeyContext, Model, ModelContext, ParentElement, Point, Render, Size,
StatefulInteractive, StatelessInteractive, StatelessInteractivity, Styled, Subscription, Task,
View, ViewContext, VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle,
WindowOptions,
actions, div, point, prelude::*, rems, size, Action, AnyModel, AnyView, AnyWeakView,
AppContext, AsyncAppContext, AsyncWindowContext, Bounds, Component, Entity, EntityId,
EventEmitter, FocusHandle, GlobalPixels, KeyContext, Model, ModelContext, Node,
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;
@ -443,7 +442,6 @@ struct Follower {
impl AppState {
#[cfg(any(test, feature = "test-support"))]
pub fn test(cx: &mut AppContext) -> Arc<Self> {
use gpui::Context;
use node_runtime::FakeNodeRuntime;
use settings2::SettingsStore;
@ -531,13 +529,7 @@ pub enum Event {
pub struct Workspace {
weak_self: WeakView<Self>,
focus_handle: FocusHandle,
workspace_actions: Vec<
Box<
dyn Fn(
Div<Workspace, StatelessInteractivity<Workspace>>,
) -> Div<Workspace, StatelessInteractivity<Workspace>>,
>,
>,
workspace_actions: Vec<Box<dyn Fn(Node<Workspace>) -> Node<Workspace>>>,
zoomed: Option<AnyWeakView>,
zoomed_position: Option<DockPosition>,
center: PaneGroup,
@ -3450,7 +3442,6 @@ impl Workspace {
#[cfg(any(test, feature = "test-support"))]
pub fn test_new(project: Model<Project>, cx: &mut ViewContext<Self>) -> Self {
use gpui::Context;
use node_runtime::FakeNodeRuntime;
let client = project.read(cx).client();
@ -3512,10 +3503,7 @@ impl Workspace {
}));
}
fn add_workspace_actions_listeners(
&self,
mut div: Div<Workspace, StatelessInteractivity<Workspace>>,
) -> Div<Workspace, StatelessInteractivity<Workspace>> {
fn add_workspace_actions_listeners(&self, mut div: Node<Workspace>) -> Node<Workspace> {
for action in self.workspace_actions.iter() {
div = (action)(div)
}
@ -3740,14 +3728,14 @@ fn notify_if_database_failed(workspace: WindowHandle<Workspace>, cx: &mut AsyncA
impl EventEmitter<Event> for Workspace {}
impl Render for Workspace {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let mut context = KeyContext::default();
context.add("Workspace");
self.add_workspace_actions_listeners(div())
.context(context)
.key_context(context)
.relative()
.size_full()
.flex()