Show settings file errors on startup (#23817)
Required using a global `LazyLock<Mutex<AppNotifications>>` instead of a context global because settings errors first occur before initialization of the notifications global. Release Notes: - Errors in settings file are now reported in UI on startup.
This commit is contained in:
parent
06936c69f6
commit
dbdf140ca1
5 changed files with 74 additions and 89 deletions
|
@ -3,7 +3,6 @@ use fs::Fs;
|
|||
use futures::{channel::mpsc, StreamExt};
|
||||
use gpui::{App, BackgroundExecutor, ReadGlobal, UpdateGlobal};
|
||||
use std::{path::PathBuf, sync::Arc, time::Duration};
|
||||
use util::ResultExt;
|
||||
|
||||
pub const EMPTY_THEME_NAME: &str = "empty-theme";
|
||||
|
||||
|
@ -73,9 +72,11 @@ pub fn handle_settings_file_changes(
|
|||
.block(user_settings_file_rx.next())
|
||||
.unwrap();
|
||||
SettingsStore::update_global(cx, |store, cx| {
|
||||
store
|
||||
.set_user_settings(&user_settings_content, cx)
|
||||
.log_err();
|
||||
let result = store.set_user_settings(&user_settings_content, cx);
|
||||
if let Err(err) = &result {
|
||||
log::error!("Failed to load user settings: {err}");
|
||||
}
|
||||
settings_changed(result.err(), cx);
|
||||
});
|
||||
cx.spawn(move |cx| async move {
|
||||
while let Some(user_settings_content) = user_settings_file_rx.next().await {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue