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.

Fixed failling tests

Mikayla Maki2802e3a1c68f
diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs
index ab952614617..98ca06e1fcf 100644
--- a/crates/client/src/user.rs
+++ b/crates/client/src/user.rs
@@ -149,12 +149,11 @@ impl UserStore {
);
cx.update(|cx| {
- cx.update_global::<StaffMode, _, _>(|staff_mode, _| {
- *staff_mode = info
- .as_ref()
+ cx.set_global(
+ info.as_ref()
.map(|info| StaffMode(info.staff))
- .unwrap_or(StaffMode(false));
- })
+ .unwrap_or(StaffMode(false)),
+ );
});
current_user_tx.send(user).await.ok();
diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs
index 45dc36a3adf..ad22baf8b92 100644
--- a/crates/theme_selector/src/theme_selector.rs
+++ b/crates/theme_selector/src/theme_selector.rs
@@ -45,7 +45,7 @@ impl ThemeSelector {
let original_theme = settings.theme.clone();
let mut theme_names = registry
- .list(**cx.global::<StaffMode>())
+ .list(**cx.try_global::<StaffMode>().unwrap_or(&StaffMode(false)))
.collect::<Vec<_>>();
theme_names.sort_unstable_by(|a, b| {
a.is_light
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index af7dfdaee0e..d1ec3f24515 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -303,7 +303,7 @@ pub fn initialize_workspace(
let theme_names = app_state
.themes
- .list(**cx.global::<StaffMode>())
+ .list(**cx.try_global::<StaffMode>().unwrap_or(&StaffMode(false)))
.map(|meta| meta.name)
.collect();
let language_names = app_state.languages.language_names();