Added welcome experience sketch
Made toolbar hideable
This commit is contained in:
parent
7d7053b990
commit
5210be95fe
9 changed files with 103 additions and 51 deletions
|
@ -4,6 +4,7 @@ pub mod query;
|
||||||
// Re-export
|
// Re-export
|
||||||
pub use anyhow;
|
pub use anyhow;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
use gpui::MutableAppContext;
|
||||||
pub use indoc::indoc;
|
pub use indoc::indoc;
|
||||||
pub use lazy_static;
|
pub use lazy_static;
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
|
@ -17,6 +18,7 @@ use sqlez::domain::Migrator;
|
||||||
use sqlez::thread_safe_connection::ThreadSafeConnection;
|
use sqlez::thread_safe_connection::ThreadSafeConnection;
|
||||||
use sqlez_macros::sql;
|
use sqlez_macros::sql;
|
||||||
use std::fs::create_dir_all;
|
use std::fs::create_dir_all;
|
||||||
|
use std::future::Future;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
@ -237,6 +239,15 @@ macro_rules! define_connection {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn write_and_log<F>(cx: &mut MutableAppContext, db_write: impl FnOnce() -> F + Send + 'static)
|
||||||
|
where
|
||||||
|
F: Future<Output = anyhow::Result<()>> + Send,
|
||||||
|
{
|
||||||
|
cx.background()
|
||||||
|
.spawn(async move { db_write().await.log_err() })
|
||||||
|
.detach()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{fs, thread};
|
use std::{fs, thread};
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub fn init(cx: &mut MutableAppContext) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WelcomePage {
|
pub struct WelcomePage {
|
||||||
_settings_subscription: Subscription,
|
_settings_subscription: Subscription,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ impl View for WelcomePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WelcomePage {
|
impl WelcomePage {
|
||||||
fn new(cx: &mut ViewContext<Self>) -> Self {
|
pub fn new(cx: &mut ViewContext<Self>) -> Self {
|
||||||
let handle = cx.weak_handle();
|
let handle = cx.weak_handle();
|
||||||
|
|
||||||
let settings_subscription = cx.observe_global::<Settings, _>(move |cx| {
|
let settings_subscription = cx.observe_global::<Settings, _>(move |cx| {
|
||||||
|
@ -163,4 +163,8 @@ impl Item for WelcomePage {
|
||||||
)
|
)
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn show_toolbar(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,20 +39,24 @@ impl_internal_actions!(dock, [MoveDock, AddDefaultItemToDock]);
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_action(Dock::focus_dock);
|
cx.add_action(Dock::focus_dock);
|
||||||
cx.add_action(Dock::hide_dock);
|
cx.add_action(Dock::hide_dock);
|
||||||
cx.add_action(Dock::move_dock);
|
cx.add_action(
|
||||||
|
|workspace: &mut Workspace, &MoveDock(dock_anchor), cx: &mut ViewContext<Workspace>| {
|
||||||
|
Dock::move_dock(workspace, dock_anchor, true, cx);
|
||||||
|
},
|
||||||
|
);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|workspace: &mut Workspace, _: &AnchorDockRight, cx: &mut ViewContext<Workspace>| {
|
|workspace: &mut Workspace, _: &AnchorDockRight, cx: &mut ViewContext<Workspace>| {
|
||||||
Dock::move_dock(workspace, &MoveDock(DockAnchor::Right), cx)
|
Dock::move_dock(workspace, DockAnchor::Right, true, cx);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|workspace: &mut Workspace, _: &AnchorDockBottom, cx: &mut ViewContext<Workspace>| {
|
|workspace: &mut Workspace, _: &AnchorDockBottom, cx: &mut ViewContext<Workspace>| {
|
||||||
Dock::move_dock(workspace, &MoveDock(DockAnchor::Bottom), cx)
|
Dock::move_dock(workspace, DockAnchor::Bottom, true, cx)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|workspace: &mut Workspace, _: &ExpandDock, cx: &mut ViewContext<Workspace>| {
|
|workspace: &mut Workspace, _: &ExpandDock, cx: &mut ViewContext<Workspace>| {
|
||||||
Dock::move_dock(workspace, &MoveDock(DockAnchor::Expanded), cx)
|
Dock::move_dock(workspace, DockAnchor::Expanded, true, cx)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|
@ -215,6 +219,7 @@ impl Dock {
|
||||||
pub(crate) fn set_dock_position(
|
pub(crate) fn set_dock_position(
|
||||||
workspace: &mut Workspace,
|
workspace: &mut Workspace,
|
||||||
new_position: DockPosition,
|
new_position: DockPosition,
|
||||||
|
focus: bool,
|
||||||
cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
) {
|
) {
|
||||||
workspace.dock.position = new_position;
|
workspace.dock.position = new_position;
|
||||||
|
@ -235,19 +240,23 @@ impl Dock {
|
||||||
let pane = workspace.dock.pane.clone();
|
let pane = workspace.dock.pane.clone();
|
||||||
if pane.read(cx).items().next().is_none() {
|
if pane.read(cx).items().next().is_none() {
|
||||||
if let Some(item_to_add) = (workspace.dock.default_item_factory)(workspace, cx) {
|
if let Some(item_to_add) = (workspace.dock.default_item_factory)(workspace, cx) {
|
||||||
Pane::add_item(workspace, &pane, item_to_add, true, true, None, cx);
|
Pane::add_item(workspace, &pane, item_to_add, focus, focus, None, cx);
|
||||||
} else {
|
} else {
|
||||||
workspace.dock.position = workspace.dock.position.hide();
|
workspace.dock.position = workspace.dock.position.hide();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cx.focus(pane);
|
if focus {
|
||||||
|
cx.focus(pane);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if let Some(last_active_center_pane) = workspace
|
} else if let Some(last_active_center_pane) = workspace
|
||||||
.last_active_center_pane
|
.last_active_center_pane
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|pane| pane.upgrade(cx))
|
.and_then(|pane| pane.upgrade(cx))
|
||||||
{
|
{
|
||||||
cx.focus(last_active_center_pane);
|
if focus {
|
||||||
|
cx.focus(last_active_center_pane);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cx.emit(crate::Event::DockAnchorChanged);
|
cx.emit(crate::Event::DockAnchorChanged);
|
||||||
workspace.serialize_workspace(cx);
|
workspace.serialize_workspace(cx);
|
||||||
|
@ -255,11 +264,11 @@ impl Dock {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hide(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
pub fn hide(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
||||||
Self::set_dock_position(workspace, workspace.dock.position.hide(), cx);
|
Self::set_dock_position(workspace, workspace.dock.position.hide(), true, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
pub fn show(workspace: &mut Workspace, focus: bool, cx: &mut ViewContext<Workspace>) {
|
||||||
Self::set_dock_position(workspace, workspace.dock.position.show(), cx);
|
Self::set_dock_position(workspace, workspace.dock.position.show(), focus, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hide_on_sidebar_shown(
|
pub fn hide_on_sidebar_shown(
|
||||||
|
@ -275,19 +284,20 @@ impl Dock {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn focus_dock(workspace: &mut Workspace, _: &FocusDock, cx: &mut ViewContext<Workspace>) {
|
fn focus_dock(workspace: &mut Workspace, _: &FocusDock, cx: &mut ViewContext<Workspace>) {
|
||||||
Self::set_dock_position(workspace, workspace.dock.position.show(), cx);
|
Self::set_dock_position(workspace, workspace.dock.position.show(), true, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hide_dock(workspace: &mut Workspace, _: &HideDock, cx: &mut ViewContext<Workspace>) {
|
fn hide_dock(workspace: &mut Workspace, _: &HideDock, cx: &mut ViewContext<Workspace>) {
|
||||||
Self::set_dock_position(workspace, workspace.dock.position.hide(), cx);
|
Self::set_dock_position(workspace, workspace.dock.position.hide(), true, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_dock(
|
pub fn move_dock(
|
||||||
workspace: &mut Workspace,
|
workspace: &mut Workspace,
|
||||||
&MoveDock(new_anchor): &MoveDock,
|
new_anchor: DockAnchor,
|
||||||
|
focus: bool,
|
||||||
cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
) {
|
) {
|
||||||
Self::set_dock_position(workspace, DockPosition::Shown(new_anchor), cx);
|
Self::set_dock_position(workspace, DockPosition::Shown(new_anchor), focus, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(
|
pub fn render(
|
||||||
|
|
|
@ -151,6 +151,9 @@ pub trait Item: View {
|
||||||
"deserialize() must be implemented if serialized_item_kind() returns Some(_)"
|
"deserialize() must be implemented if serialized_item_kind() returns Some(_)"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn show_toolbar(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ItemHandle: 'static + fmt::Debug {
|
pub trait ItemHandle: 'static + fmt::Debug {
|
||||||
|
@ -213,6 +216,7 @@ pub trait ItemHandle: 'static + fmt::Debug {
|
||||||
fn breadcrumb_location(&self, cx: &AppContext) -> ToolbarItemLocation;
|
fn breadcrumb_location(&self, cx: &AppContext) -> ToolbarItemLocation;
|
||||||
fn breadcrumbs(&self, theme: &Theme, cx: &AppContext) -> Option<Vec<ElementBox>>;
|
fn breadcrumbs(&self, theme: &Theme, cx: &AppContext) -> Option<Vec<ElementBox>>;
|
||||||
fn serialized_item_kind(&self) -> Option<&'static str>;
|
fn serialized_item_kind(&self) -> Option<&'static str>;
|
||||||
|
fn show_toolbar(&self, cx: &AppContext) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait WeakItemHandle {
|
pub trait WeakItemHandle {
|
||||||
|
@ -591,6 +595,10 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
||||||
fn serialized_item_kind(&self) -> Option<&'static str> {
|
fn serialized_item_kind(&self) -> Option<&'static str> {
|
||||||
T::serialized_item_kind()
|
T::serialized_item_kind()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn show_toolbar(&self, cx: &AppContext) -> bool {
|
||||||
|
self.read(cx).show_toolbar()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Box<dyn ItemHandle>> for AnyViewHandle {
|
impl From<Box<dyn ItemHandle>> for AnyViewHandle {
|
||||||
|
|
|
@ -1485,11 +1485,12 @@ impl View for Pane {
|
||||||
cx,
|
cx,
|
||||||
{
|
{
|
||||||
let toolbar = self.toolbar.clone();
|
let toolbar = self.toolbar.clone();
|
||||||
|
let toolbar_hidden = toolbar.read(cx).hidden();
|
||||||
move |_, cx| {
|
move |_, cx| {
|
||||||
Flex::column()
|
Flex::column()
|
||||||
.with_child(
|
.with_children((!toolbar_hidden).then(|| {
|
||||||
ChildView::new(&toolbar, cx).expanded().boxed(),
|
ChildView::new(&toolbar, cx).expanded().boxed()
|
||||||
)
|
}))
|
||||||
.with_child(
|
.with_child(
|
||||||
ChildView::new(active_item, cx)
|
ChildView::new(active_item, cx)
|
||||||
.flex(1., true)
|
.flex(1., true)
|
||||||
|
|
|
@ -42,6 +42,7 @@ pub enum ToolbarItemLocation {
|
||||||
|
|
||||||
pub struct Toolbar {
|
pub struct Toolbar {
|
||||||
active_pane_item: Option<Box<dyn ItemHandle>>,
|
active_pane_item: Option<Box<dyn ItemHandle>>,
|
||||||
|
hidden: bool,
|
||||||
pane: WeakViewHandle<Pane>,
|
pane: WeakViewHandle<Pane>,
|
||||||
items: Vec<(Box<dyn ToolbarItemViewHandle>, ToolbarItemLocation)>,
|
items: Vec<(Box<dyn ToolbarItemViewHandle>, ToolbarItemLocation)>,
|
||||||
}
|
}
|
||||||
|
@ -211,6 +212,7 @@ impl Toolbar {
|
||||||
active_pane_item: None,
|
active_pane_item: None,
|
||||||
pane,
|
pane,
|
||||||
items: Default::default(),
|
items: Default::default(),
|
||||||
|
hidden: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +245,12 @@ impl Toolbar {
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) {
|
) {
|
||||||
self.active_pane_item = pane_item.map(|item| item.boxed_clone());
|
self.active_pane_item = pane_item.map(|item| item.boxed_clone());
|
||||||
|
self.hidden = self
|
||||||
|
.active_pane_item
|
||||||
|
.as_ref()
|
||||||
|
.map(|item| !item.show_toolbar(cx))
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
for (toolbar_item, current_location) in self.items.iter_mut() {
|
for (toolbar_item, current_location) in self.items.iter_mut() {
|
||||||
let new_location = toolbar_item.set_active_pane_item(pane_item, cx);
|
let new_location = toolbar_item.set_active_pane_item(pane_item, cx);
|
||||||
if new_location != *current_location {
|
if new_location != *current_location {
|
||||||
|
@ -257,6 +265,10 @@ impl Toolbar {
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|(item, _)| item.to_any().downcast())
|
.find_map(|(item, _)| item.to_any().downcast())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn hidden(&self) -> bool {
|
||||||
|
self.hidden
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ToolbarItemView> ToolbarItemViewHandle for ViewHandle<T> {
|
impl<T: ToolbarItemView> ToolbarItemViewHandle for ViewHandle<T> {
|
||||||
|
|
|
@ -197,20 +197,12 @@ pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cx.add_global_action({
|
|
||||||
let app_state = Arc::downgrade(&app_state);
|
|
||||||
move |_: &Welcome, cx: &mut MutableAppContext| {
|
|
||||||
if let Some(app_state) = app_state.upgrade() {
|
|
||||||
open_new(&app_state, cx).detach();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cx.add_global_action({
|
cx.add_global_action({
|
||||||
let app_state = Arc::downgrade(&app_state);
|
let app_state = Arc::downgrade(&app_state);
|
||||||
move |_: &NewWindow, cx: &mut MutableAppContext| {
|
move |_: &NewWindow, cx: &mut MutableAppContext| {
|
||||||
if let Some(app_state) = app_state.upgrade() {
|
if let Some(app_state) = app_state.upgrade() {
|
||||||
open_new(&app_state, cx).detach();
|
open_new(&app_state, cx, |_, cx| cx.dispatch_action(NewFile)).detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1514,7 +1506,7 @@ impl Workspace {
|
||||||
self.active_item_path_changed(cx);
|
self.active_item_path_changed(cx);
|
||||||
|
|
||||||
if &pane == self.dock_pane() {
|
if &pane == self.dock_pane() {
|
||||||
Dock::show(self, cx);
|
Dock::show(self, true, cx);
|
||||||
} else {
|
} else {
|
||||||
self.last_active_center_pane = Some(pane.downgrade());
|
self.last_active_center_pane = Some(pane.downgrade());
|
||||||
if self.dock.is_anchored_at(DockAnchor::Expanded) {
|
if self.dock.is_anchored_at(DockAnchor::Expanded) {
|
||||||
|
@ -2527,7 +2519,12 @@ impl Workspace {
|
||||||
// the focus the dock generates start generating alternating
|
// the focus the dock generates start generating alternating
|
||||||
// focus due to the deferred execution each triggering each other
|
// focus due to the deferred execution each triggering each other
|
||||||
cx.after_window_update(move |workspace, cx| {
|
cx.after_window_update(move |workspace, cx| {
|
||||||
Dock::set_dock_position(workspace, serialized_workspace.dock_position, cx);
|
Dock::set_dock_position(
|
||||||
|
workspace,
|
||||||
|
serialized_workspace.dock_position,
|
||||||
|
true,
|
||||||
|
cx,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
@ -2859,14 +2856,18 @@ pub fn open_paths(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_new(app_state: &Arc<AppState>, cx: &mut MutableAppContext) -> Task<()> {
|
pub fn open_new(
|
||||||
|
app_state: &Arc<AppState>,
|
||||||
|
cx: &mut MutableAppContext,
|
||||||
|
init: impl FnOnce(&mut Workspace, &mut ViewContext<Workspace>) + 'static,
|
||||||
|
) -> Task<()> {
|
||||||
let task = Workspace::new_local(Vec::new(), app_state.clone(), cx);
|
let task = Workspace::new_local(Vec::new(), app_state.clone(), cx);
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
let (workspace, opened_paths) = task.await;
|
let (workspace, opened_paths) = task.await;
|
||||||
|
|
||||||
workspace.update(&mut cx, |_, cx| {
|
workspace.update(&mut cx, |workspace, cx| {
|
||||||
if opened_paths.is_empty() {
|
if opened_paths.is_empty() {
|
||||||
cx.dispatch_action(Welcome);
|
init(workspace, cx)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -35,7 +35,7 @@ use std::{borrow::Cow, env, path::Path, str, sync::Arc};
|
||||||
use util::{channel::ReleaseChannel, paths, ResultExt, StaffMode};
|
use util::{channel::ReleaseChannel, paths, ResultExt, StaffMode};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
pub use workspace;
|
pub use workspace;
|
||||||
use workspace::{sidebar::SidebarSide, AppState, Restart, Welcome, Workspace};
|
use workspace::{dock::Dock, open_new, sidebar::SidebarSide, AppState, Restart, Workspace};
|
||||||
|
|
||||||
pub const FIRST_OPEN: &str = "first_open";
|
pub const FIRST_OPEN: &str = "first_open";
|
||||||
|
|
||||||
|
@ -256,23 +256,27 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
cx.add_global_action(|_: &WelcomeExperience, cx| {
|
cx.add_global_action({
|
||||||
if !matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
|
let app_state = app_state.clone();
|
||||||
return; //noop, in case someone fires this from the command palette
|
move |_: &WelcomeExperience, cx| {
|
||||||
}
|
if !matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
|
||||||
|
return; //noop, in case someone fires this from the command palette
|
||||||
|
}
|
||||||
|
|
||||||
// Make a workspace, set it up with an open bottom dock and the welcome page
|
open_new(&app_state, cx, |workspace, cx| {
|
||||||
|
workspace.toggle_sidebar(SidebarSide::Left, cx);
|
||||||
cx.dispatch_global_action(Welcome);
|
let welcome_page = cx.add_view(|cx| welcome::WelcomePage::new(cx));
|
||||||
|
workspace.add_item(Box::new(welcome_page.clone()), cx);
|
||||||
cx.background()
|
Dock::move_dock(workspace, settings::DockAnchor::Bottom, false, cx);
|
||||||
.spawn(async move {
|
cx.focus(welcome_page);
|
||||||
KEY_VALUE_STORE
|
cx.notify();
|
||||||
.write_kvp(FIRST_OPEN.to_string(), "false".to_string())
|
|
||||||
.await
|
|
||||||
.log_err();
|
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
|
db::write_and_log(cx, || {
|
||||||
|
KEY_VALUE_STORE.write_kvp(FIRST_OPEN.to_string(), "false".to_string())
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
activity_indicator::init(cx);
|
activity_indicator::init(cx);
|
||||||
|
@ -881,7 +885,8 @@ mod tests {
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_new_empty_workspace(cx: &mut TestAppContext) {
|
async fn test_new_empty_workspace(cx: &mut TestAppContext) {
|
||||||
let app_state = init(cx);
|
let app_state = init(cx);
|
||||||
cx.update(|cx| open_new(&app_state, cx)).await;
|
cx.update(|cx| open_new(&app_state, cx, |_, cx| cx.dispatch_action(NewFile)))
|
||||||
|
.await;
|
||||||
|
|
||||||
let window_id = *cx.window_ids().first().unwrap();
|
let window_id = *cx.window_ids().first().unwrap();
|
||||||
let workspace = cx.root_view::<Workspace>(window_id).unwrap();
|
let workspace = cx.root_view::<Workspace>(window_id).unwrap();
|
||||||
|
|
|
@ -248,7 +248,7 @@ export default function workspace(colorScheme: ColorScheme) {
|
||||||
},
|
},
|
||||||
dock: {
|
dock: {
|
||||||
initialSizeRight: 640,
|
initialSizeRight: 640,
|
||||||
initialSizeBottom: 480,
|
initialSizeBottom: 300,
|
||||||
wash_color: withOpacity(background(colorScheme.highest), 0.5),
|
wash_color: withOpacity(background(colorScheme.highest), 0.5),
|
||||||
panel: {
|
panel: {
|
||||||
border: border(colorScheme.middle),
|
border: border(colorScheme.middle),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue