Define workspace settings in workspace crate
This commit is contained in:
parent
cbd4771f10
commit
6403bb86e1
22 changed files with 253 additions and 243 deletions
|
@ -1,5 +1,9 @@
|
|||
mod toggle_dock_button;
|
||||
|
||||
use crate::{
|
||||
sidebar::SidebarSide, BackgroundActions, DockAnchor, ItemHandle, Pane, Workspace,
|
||||
WorkspaceSettings,
|
||||
};
|
||||
use collections::HashMap;
|
||||
use gpui::{
|
||||
actions,
|
||||
|
@ -8,10 +12,7 @@ use gpui::{
|
|||
platform::{CursorStyle, MouseButton},
|
||||
AnyElement, AppContext, Border, Element, SizeConstraint, ViewContext, ViewHandle,
|
||||
};
|
||||
use settings::{DockAnchor, Settings};
|
||||
use theme::Theme;
|
||||
|
||||
use crate::{sidebar::SidebarSide, BackgroundActions, ItemHandle, Pane, Workspace};
|
||||
pub use toggle_dock_button::ToggleDockButton;
|
||||
|
||||
actions!(
|
||||
|
@ -171,7 +172,9 @@ impl Dock {
|
|||
background_actions: BackgroundActions,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Self {
|
||||
let position = DockPosition::Hidden(cx.global::<Settings>().default_dock_anchor);
|
||||
let position = DockPosition::Hidden(
|
||||
settings::get_setting::<WorkspaceSettings>(None, cx).default_dock_anchor,
|
||||
);
|
||||
let workspace = cx.weak_handle();
|
||||
let pane =
|
||||
cx.add_view(|cx| Pane::new(workspace, Some(position.anchor()), background_actions, cx));
|
||||
|
@ -405,7 +408,6 @@ mod tests {
|
|||
|
||||
use gpui::{AppContext, BorrowWindowContext, TestAppContext, ViewContext, WindowContext};
|
||||
use project::{FakeFs, Project};
|
||||
use settings::Settings;
|
||||
use theme::ThemeRegistry;
|
||||
|
||||
use super::*;
|
||||
|
@ -417,6 +419,7 @@ mod tests {
|
|||
},
|
||||
register_deserializable_item,
|
||||
sidebar::Sidebar,
|
||||
tests::init_test,
|
||||
AppState, ItemHandle, Workspace,
|
||||
};
|
||||
|
||||
|
@ -429,8 +432,7 @@ mod tests {
|
|||
|
||||
#[gpui::test]
|
||||
async fn test_dock_workspace_infinite_loop(cx: &mut TestAppContext) {
|
||||
cx.foreground().forbid_parking();
|
||||
Settings::test_async(cx);
|
||||
init_test(cx);
|
||||
|
||||
cx.update(|cx| {
|
||||
register_deserializable_item::<item::test::TestItem>(cx);
|
||||
|
@ -598,7 +600,7 @@ mod tests {
|
|||
|
||||
impl<'a> DockTestContext<'a> {
|
||||
pub async fn new(cx: &'a mut TestAppContext) -> DockTestContext<'a> {
|
||||
Settings::test_async(cx);
|
||||
init_test(cx);
|
||||
let fs = FakeFs::new(cx.background());
|
||||
|
||||
cx.update(|cx| init(cx));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue