From 7cb8935ff5061379cbbcee1a616ade75f59a1f70 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sun, 20 Mar 2022 08:54:20 -0600 Subject: [PATCH] Pass project entry id to Pane when opening a project items This fixes an oversight where we were failing to associate project items with their project entry ids, which broke the logic that prevented the same project entry from being opened twice in the same pane. --- crates/workspace/src/workspace.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 33155b5d4f..9b9477353b 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -862,10 +862,9 @@ impl Workspace { { use project::Item as _; - if let Some(item) = project_item - .read(cx) - .entry_id(cx) - .and_then(|entry_id| self.active_pane().read(cx).item_for_entry(entry_id)) + let entry_id = project_item.read(cx).entry_id(cx); + if let Some(item) = entry_id + .and_then(|entry_id| self.active_pane().read(cx).item_for_entry(dbg!(entry_id))) .and_then(|item| item.downcast()) { self.activate_item(&item, cx); @@ -873,7 +872,9 @@ impl Workspace { } let item = cx.add_view(|cx| T::for_project_item(self.project().clone(), project_item, cx)); - self.add_item(Box::new(item.clone()), cx); + self.active_pane().update(cx, |pane, cx| { + pane.add_item(entry_id, Box::new(item.clone()), cx) + }); item }