diff --git a/crates/project/src/fs.rs b/crates/project/src/fs.rs index ec7925685d..bc815f5be1 100644 --- a/crates/project/src/fs.rs +++ b/crates/project/src/fs.rs @@ -379,7 +379,7 @@ impl FakeFs { async fn simulate_random_delay(&self) { self.executor .upgrade() - .expect("excecutor has been dropped") + .expect("executor has been dropped") .simulate_random_delay() .await; } @@ -647,9 +647,16 @@ impl Fs for FakeFs { let (tx, rx) = smol::channel::unbounded(); state.event_txs.push(tx); let path = path.to_path_buf(); + let executor = self.executor.clone(); Box::pin(futures::StreamExt::filter(rx, move |events| { let result = events.iter().any(|event| event.path.starts_with(&path)); - async move { result } + let executor = executor.clone(); + async move { + if let Some(executor) = executor.clone().upgrade() { + executor.simulate_random_delay().await; + } + result + } })) } diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index d038ac941f..001667d311 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -295,9 +295,9 @@ impl ProjectPanel { .save(new_path, Default::default(), cx) }); Some(cx.spawn(|this, mut cx| async move { - save.await?; + let new_entry = save.await?; this.update(&mut cx, |this, cx| { - this.update_visible_entries(None, cx); + this.update_visible_entries(Some((edit_state.worktree_id, new_entry.id)), cx); cx.notify(); }); Ok(()) @@ -1005,12 +1005,12 @@ mod tests { assert_eq!( visible_entries_as_strings(&panel, 0..10, cx), &[ - "v root1 <== selected", + "v root1", " > a", " > b", " > C", " .dockerignore", - " the-new-filename", + " the-new-filename <== selected", "v root2", " > d", " > e", @@ -1048,10 +1048,10 @@ mod tests { &[ "v root1", " > a", - " v b <== selected", + " v b", " > 3", " > 4", - " another-filename", + " another-filename <== selected", " > C", " .dockerignore", " the-new-filename",