Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

WIP

Mikayla75a80811b3bc
diff --git a/crates/collab/src/tests/test_server.rs b/crates/collab/src/tests/test_server.rs
index d6ebe1e84ef..245f34ebac5 100644
--- a/crates/collab/src/tests/test_server.rs
+++ b/crates/collab/src/tests/test_server.rs
@@ -124,6 +124,7 @@ impl TestServer {
if cx.has_global::<SettingsStore>() {
panic!("Same cx used to create two test clients")
}
+
cx.set_global(SettingsStore::test(cx));
});
diff --git a/crates/collab2/collab/src/tests/integration_tests.rs b/crates/collab2/collab/src/tests/integration_tests.rs
index b9cd79453a9..7dde04ee57f 100644
--- a/crates/collab2/collab/src/tests/integration_tests.rs
+++ b/crates/collab2/collab/src/tests/integration_tests.rs
@@ -3223,12 +3223,16 @@ async fn test_local_settings(
cx_b: &mut TestAppContext,
) {
deterministic.forbid_parking();
+ dbg!("HERE111");
let mut server = TestServer::start(&deterministic).await;
+ dbg!("HERE");
let client_a = server.create_client(cx_a, "user_a").await;
+ dbg!("HERE2");
let client_b = server.create_client(cx_b, "user_b").await;
server
.create_room(&mut [(&client_a, cx_a), (&client_b, cx_b)])
.await;
+ dbg!("HERE4");
let active_call_a = cx_a.read(ActiveCall::global);
// As client A, open a project that contains some local settings files
@@ -3259,6 +3263,7 @@ async fn test_local_settings(
.await
.unwrap();
+ dbg!("HERE6");
// As client B, join that project and observe the local settings.
let project_b = client_b.build_remote_project(project_id, cx_b).await;
let worktree_b = project_b.read_with(cx_b, |project, cx| project.worktrees(cx).next().unwrap());
@@ -3317,11 +3322,11 @@ async fn test_local_settings(
]
)
});
-
+ dbg!("GOT TO THE DISCONNECT");
// As client B, disconnect.
server.forbid_connections();
server.disconnect_client(client_b.peer_id().unwrap());
-
+ dbg!("GOT PAST DISCONNECT");
// As client A, change and remove settings files while client B is disconnected.
client_a
.fs()
@@ -3344,6 +3349,7 @@ async fn test_local_settings(
&[(Path::new("a").into(), r#"{"hard_tabs":true}"#.to_string()),]
)
});
+ dbg!("GOT TO THE END");
}
#[gpui::test(iterations = 10)]
diff --git a/crates/collab2/src/tests/test_server.rs b/crates/collab2/src/tests/test_server.rs
index 76a587ffde3..ddbfd4a4955 100644
--- a/crates/collab2/src/tests/test_server.rs
+++ b/crates/collab2/src/tests/test_server.rs
@@ -122,6 +122,7 @@ impl TestServer {
pub async fn create_client(&mut self, cx: &mut TestAppContext, name: &str) -> TestClient {
cx.update(|cx| {
+ println!("PLS SHOW UP");
if cx.has_global::<SettingsStore>() {
panic!("Same cx used to create two test clients")
}
diff --git a/crates/gpui2/src/app.rs b/crates/gpui2/src/app.rs
index 1b5af755b30..05ab7b2932a 100644
--- a/crates/gpui2/src/app.rs
+++ b/crates/gpui2/src/app.rs
@@ -706,6 +706,7 @@ impl AppContext {
}
/// Access the global of the given type. Panics if a global for that type has not been assigned.
+ #[track_caller]
pub fn global<G: 'static>(&self) -> &G {
self.globals_by_type
.get(&TypeId::of::<G>())
@@ -722,6 +723,7 @@ impl AppContext {
}
/// Access the global of the given type mutably. Panics if a global for that type has not been assigned.
+ #[track_caller]
pub fn global_mut<G: 'static>(&mut self) -> &mut G {
let global_type = TypeId::of::<G>();
self.push_effect(Effect::NotifyGlobalObservers { global_type });
diff --git a/crates/settings2/src/settings_store.rs b/crates/settings2/src/settings_store.rs
index 3317a50f524..5bf10a518d0 100644
--- a/crates/settings2/src/settings_store.rs
+++ b/crates/settings2/src/settings_store.rs
@@ -86,6 +86,7 @@ pub trait Settings: 'static + Send + Sync {
});
}
+ #[track_caller]
fn get<'a>(path: Option<(usize, &Path)>, cx: &'a AppContext) -> &'a Self
where
Self: Sized,
@@ -93,6 +94,7 @@ pub trait Settings: 'static + Send + Sync {
cx.global::<SettingsStore>().get(path)
}
+ #[track_caller]
fn get_global<'a>(cx: &'a AppContext) -> &'a Self
where
Self: Sized,
@@ -100,6 +102,7 @@ pub trait Settings: 'static + Send + Sync {
cx.global::<SettingsStore>().get(None)
}
+ #[track_caller]
fn override_global<'a>(settings: Self, cx: &'a mut AppContext)
where
Self: Sized,