First pass on fixes

This commit is contained in:
Piotr Osiewicz 2025-08-19 14:23:59 +02:00
parent 5826d89b97
commit 2f3be75fc7
269 changed files with 1593 additions and 2574 deletions

View file

@ -1026,8 +1026,8 @@ async fn restore_or_create_workspace(app_state: Arc<AppState>, cx: &mut AsyncApp
// Try to find an active workspace to show the toast
let toast_shown = cx
.update(|cx| {
if let Some(window) = cx.active_window() {
if let Some(workspace) = window.downcast::<Workspace>() {
if let Some(window) = cx.active_window()
&& let Some(workspace) = window.downcast::<Workspace>() {
workspace
.update(cx, |workspace, _, cx| {
workspace.show_toast(
@ -1038,7 +1038,6 @@ async fn restore_or_create_workspace(app_state: Arc<AppState>, cx: &mut AsyncApp
.ok();
return true;
}
}
false
})
.unwrap_or(false);
@ -1117,11 +1116,10 @@ pub(crate) async fn restorable_workspace_locations(
// Since last_session_window_order returns the windows ordered front-to-back
// we need to open the window that was frontmost last.
if ordered {
if let Some(locations) = locations.as_mut() {
if ordered
&& let Some(locations) = locations.as_mut() {
locations.reverse();
}
}
locations
} else {
@ -1290,8 +1288,8 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
if let Some(theme_selection) = theme_settings.theme_selection.as_ref() {
let theme_name = theme_selection.theme(appearance);
if matches!(theme_registry.get(theme_name), Err(ThemeNotFoundError(_))) {
if let Some(theme_path) = extension_store.read(cx).path_to_extension_theme(theme_name) {
if matches!(theme_registry.get(theme_name), Err(ThemeNotFoundError(_)))
&& let Some(theme_path) = extension_store.read(cx).path_to_extension_theme(theme_name) {
cx.spawn({
let theme_registry = theme_registry.clone();
let fs = fs.clone();
@ -1305,7 +1303,6 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
})
.detach_and_log_err(cx);
}
}
}
if let Some(icon_theme_selection) = theme_settings.icon_theme_selection.as_ref() {
@ -1313,8 +1310,8 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
if matches!(
theme_registry.get_icon_theme(icon_theme_name),
Err(IconThemeNotFoundError(_))
) {
if let Some((icon_theme_path, icons_root_path)) = extension_store
)
&& let Some((icon_theme_path, icons_root_path)) = extension_store
.read(cx)
.path_to_extension_icon_theme(icon_theme_name)
{
@ -1333,7 +1330,6 @@ fn eager_load_active_theme_and_icon_theme(fs: Arc<dyn Fs>, cx: &App) {
})
.detach_and_log_err(cx);
}
}
}
}
@ -1381,19 +1377,16 @@ fn watch_themes(fs: Arc<dyn fs::Fs>, cx: &mut App) {
while let Some(paths) = events.next().await {
for event in paths {
if fs.metadata(&event.path).await.ok().flatten().is_some() {
if let Some(theme_registry) =
if fs.metadata(&event.path).await.ok().flatten().is_some()
&& let Some(theme_registry) =
cx.update(|cx| ThemeRegistry::global(cx).clone()).log_err()
{
if let Some(()) = theme_registry
&& let Some(()) = theme_registry
.load_user_theme(&event.path, fs.clone())
.await
.log_err()
{
cx.update(ThemeSettings::reload_current_theme).log_err();
}
}
}
}
}
})