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
+6 -6
View File
@@ -1,7 +1,7 @@
use crate::{status_bar::StatusItemView, Axis, Workspace};
use gpui::{
div, Action, AnyView, AppContext, Div, Entity, EntityId, EventEmitter, ParentElement, Render,
Subscription, View, ViewContext, WeakView, WindowContext,
div, Action, AnyView, AppContext, Entity, EntityId, EventEmitter, Node, ParentComponent,
Render, Subscription, View, ViewContext, WeakView, WindowContext,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@@ -419,7 +419,7 @@ impl Dock {
}
impl Render for Dock {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()
@@ -621,7 +621,7 @@ impl PanelButtons {
// }
impl Render for PanelButtons {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
// todo!()
@@ -647,7 +647,7 @@ impl StatusItemView for PanelButtons {
#[cfg(any(test, feature = "test-support"))]
pub mod test {
use super::*;
use gpui::{div, Div, ViewContext, WindowContext};
use gpui::{div, Node, ViewContext, WindowContext};
pub struct TestPanel {
pub position: DockPosition,
@@ -672,7 +672,7 @@ pub mod test {
}
impl Render for TestPanel {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
div()
+3 -3
View File
@@ -1,6 +1,6 @@
use gpui::{
div, px, AnyView, Div, EventEmitter, FocusHandle, ParentElement, Render, StatelessInteractive,
Styled, Subscription, View, ViewContext, VisualContext, WindowContext,
div, prelude::*, px, AnyView, EventEmitter, FocusHandle, InteractiveComponent, Node,
ParentComponent, Render, Styled, Subscription, View, ViewContext, VisualContext, WindowContext,
};
use ui::v_stack;
@@ -76,7 +76,7 @@ impl ModalLayer {
}
impl Render for ModalLayer {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let Some(active_modal) = &self.active_modal else {
+2 -2
View File
@@ -165,7 +165,7 @@ impl Workspace {
pub mod simple_message_notification {
use super::{Notification, NotificationEvent};
use gpui::{AnyElement, AppContext, Div, EventEmitter, Render, TextStyle, ViewContext};
use gpui::{AnyElement, AppContext, EventEmitter, Node, Render, TextStyle, ViewContext};
use serde::Deserialize;
use std::{borrow::Cow, sync::Arc};
@@ -252,7 +252,7 @@ pub mod simple_message_notification {
}
impl Render for MessageNotification {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()
+5 -7
View File
@@ -1,5 +1,3 @@
// mod dragged_item_receiver;
use crate::{
item::{Item, ItemHandle, ItemSettings, WeakItemHandle},
toolbar::Toolbar,
@@ -9,9 +7,9 @@ use crate::{
use anyhow::Result;
use collections::{HashMap, HashSet, VecDeque};
use gpui::{
actions, register_action, AppContext, AsyncWindowContext, Component, Div, EntityId,
EventEmitter, FocusHandle, Model, PromptLevel, Render, Task, View, ViewContext, VisualContext,
WeakView, WindowContext,
actions, prelude::*, register_action, AppContext, AsyncWindowContext, Component, EntityId,
EventEmitter, FocusHandle, Model, Node, PromptLevel, Render, Task, View, ViewContext,
VisualContext, WeakView, WindowContext,
};
use parking_lot::Mutex;
use project2::{Project, ProjectEntryId, ProjectPath};
@@ -1903,7 +1901,7 @@ impl Pane {
// }
impl Render for Pane {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
v_stack()
@@ -2928,7 +2926,7 @@ struct DraggedTab {
}
impl Render for DraggedTab {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div().w_8().h_4().bg(gpui::red())
+3 -3
View File
@@ -2,8 +2,8 @@ use std::any::TypeId;
use crate::{ItemHandle, Pane};
use gpui::{
div, AnyView, Component, Div, ParentElement, Render, Styled, Subscription, View, ViewContext,
WindowContext,
div, AnyView, Component, Node, ParentComponent, Render, Styled, Subscription, View,
ViewContext, WindowContext,
};
use theme2::ActiveTheme;
use util::ResultExt;
@@ -34,7 +34,7 @@ pub struct StatusBar {
}
impl Render for StatusBar {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
div()
+2 -2
View File
@@ -1,6 +1,6 @@
use crate::ItemHandle;
use gpui::{
AnyView, Div, Entity, EntityId, EventEmitter, Render, View, ViewContext, WindowContext,
AnyView, Entity, EntityId, EventEmitter, Node, Render, View, ViewContext, WindowContext,
};
pub enum ToolbarItemEvent {
@@ -52,7 +52,7 @@ pub struct Toolbar {
}
impl Render for Toolbar {
type Element = Div<Self>;
type Element = Node<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
todo!()
+9 -21
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()