Use UpdateGlobal accessors in more places (#11925)

This PR updates a number of instances that were previously using
`cx.update_global` to use `UpdateGlobal::update_global` instead.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-05-16 13:30:04 -04:00 committed by GitHub
parent c1e291bc96
commit 13bbaf1e18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 66 additions and 68 deletions

View file

@ -19,7 +19,7 @@ use editor::{
};
use futures::StreamExt;
use git::diff::DiffHunkStatus;
use gpui::{BorrowAppContext, TestAppContext, VisualContext, VisualTestContext};
use gpui::{TestAppContext, UpdateGlobal, VisualContext, VisualTestContext};
use indoc::indoc;
use language::{
language_settings::{AllLanguageSettings, InlayHintSettings},
@ -1517,7 +1517,7 @@ async fn test_mutual_editor_inlay_hint_cache_update(
cx_b.update(editor::init);
cx_a.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |settings| {
settings.defaults.inlay_hints = Some(InlayHintSettings {
enabled: true,
@ -1531,7 +1531,7 @@ async fn test_mutual_editor_inlay_hint_cache_update(
});
});
cx_b.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |settings| {
settings.defaults.inlay_hints = Some(InlayHintSettings {
enabled: true,
@ -1779,7 +1779,7 @@ async fn test_inlay_hint_refresh_is_forwarded(
cx_b.update(editor::init);
cx_a.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |settings| {
settings.defaults.inlay_hints = Some(InlayHintSettings {
enabled: false,
@ -1793,7 +1793,7 @@ async fn test_inlay_hint_refresh_is_forwarded(
});
});
cx_b.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |settings| {
settings.defaults.inlay_hints = Some(InlayHintSettings {
enabled: true,
@ -2269,14 +2269,14 @@ async fn test_git_blame_is_forwarded(cx_a: &mut TestAppContext, cx_b: &mut TestA
min_column: None,
});
cx_a.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<ProjectSettings>(cx, |settings| {
settings.git.inline_blame = inline_blame_off_settings;
});
});
});
cx_b.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<ProjectSettings>(cx, |settings| {
settings.git.inline_blame = inline_blame_off_settings;
});

View file

@ -13,8 +13,8 @@ use fs::{FakeFs, Fs as _, RemoveOptions};
use futures::{channel::mpsc, StreamExt as _};
use git::repository::GitFileStatus;
use gpui::{
px, size, AppContext, BackgroundExecutor, BorrowAppContext, Model, Modifiers, MouseButton,
MouseDownEvent, TestAppContext,
px, size, AppContext, BackgroundExecutor, Model, Modifiers, MouseButton, MouseDownEvent,
TestAppContext, UpdateGlobal,
};
use language::{
language_settings::{AllLanguageSettings, Formatter, PrettierSettings},
@ -4401,7 +4401,7 @@ async fn test_formatting_buffer(
// Ensure buffer can be formatted using an external command. Notice how the
// host's configuration is honored as opposed to using the guest's settings.
cx_a.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |file| {
file.defaults.formatter = Some(Formatter::External {
command: "awk".into(),
@ -4485,7 +4485,7 @@ async fn test_prettier_formatting_buffer(
let buffer_b = cx_b.executor().spawn(open_buffer).await.unwrap();
cx_a.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |file| {
file.defaults.formatter = Some(Formatter::Auto);
file.defaults.prettier = Some(PrettierSettings {
@ -4496,7 +4496,7 @@ async fn test_prettier_formatting_buffer(
});
});
cx_b.update(|cx| {
cx.update_global(|store: &mut SettingsStore, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |file| {
file.defaults.formatter = Some(Formatter::LanguageServer);
file.defaults.prettier = Some(PrettierSettings {