Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zed: Fix migration banner not hiding after migration has been carried out (#31723)
Smit Barmasea387bf5f54ed
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rsindex 5bd0075cad3..96ecbb85b55 100644--- a/crates/zed/src/zed.rs+++ b/crates/zed/src/zed.rs@@ -1183,19 +1183,15 @@ pub fn handle_settings_file_changes(};let result = cx.update_global(|store: &mut SettingsStore, cx| {- let content_migrated = process_settings(content, is_user, store, cx);-- if content_migrated {- if let Some(notifier) = MigrationNotification::try_global(cx) {- notifier.update(cx, |_, cx| {- cx.emit(MigrationEvent::ContentChanged {- migration_type: MigrationType::Settings,- migrated: true,- });+ let migrating_in_memory = process_settings(content, is_user, store, cx);+ if let Some(notifier) = MigrationNotification::try_global(cx) {+ notifier.update(cx, |_, cx| {+ cx.emit(MigrationEvent::ContentChanged {+ migration_type: MigrationType::Settings,+ migrating_in_memory,});- }+ });}-cx.refresh_windows();});@@ -1247,7 +1243,7 @@ pub fn handle_keymap_file_changes(cx.spawn(async move |cx| {let mut user_keymap_content = String::new();- let mut content_migrated = false;+ let mut migrating_in_memory = false;loop {select_biased! {_ = base_keymap_rx.next() => {},@@ -1256,10 +1252,10 @@ pub fn handle_keymap_file_changes(if let Some(content) = content {if let Ok(Some(migrated_content)) = migrate_keymap(&content) {user_keymap_content = migrated_content;- content_migrated = true;+ migrating_in_memory = true;} else {user_keymap_content = content;- content_migrated = false;+ migrating_in_memory = false;}}}@@ -1269,7 +1265,7 @@ pub fn handle_keymap_file_changes(notifier.update(cx, |_, cx| {cx.emit(MigrationEvent::ContentChanged {migration_type: MigrationType::Keymap,- migrated: content_migrated,+ migrating_in_memory,});});}diff --git a/crates/zed/src/zed/migrate.rs b/crates/zed/src/zed/migrate.rsindex 0adee2bf4ad..32c8c17a6f1 100644--- a/crates/zed/src/zed/migrate.rs+++ b/crates/zed/src/zed/migrate.rs@@ -29,7 +29,7 @@ pub struct MigrationBanner {pub enum MigrationEvent {ContentChanged {migration_type: MigrationType,- migrated: bool,+ migrating_in_memory: bool,},}@@ -74,9 +74,9 @@ impl MigrationBanner {match event {MigrationEvent::ContentChanged {migration_type,- migrated,+ migrating_in_memory,} => {- if *migrated {+ if *migrating_in_memory {self.migration_type = Some(*migration_type);self.show(cx);} else {