Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Return window handles from WeakItemHandle
Nathan Sobob77c336a3d71
diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rsindex 67827b78038..21956be4468 100644--- a/crates/workspace/src/item.rs+++ b/crates/workspace/src/item.rs@@ -281,7 +281,7 @@ pub trait ItemHandle: 'static + fmt::Debug {pub trait WeakItemHandle {fn id(&self) -> usize;- fn window_id(&self) -> usize;+ fn window(&self) -> AnyWindowHandle;fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>>;}@@ -650,8 +650,8 @@ impl<T: Item> WeakItemHandle for WeakViewHandle<T> {self.id()}- fn window_id(&self) -> usize {- self.window_id()+ fn window(&self) -> AnyWindowHandle {+ self.window()}fn upgrade(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>> {diff --git a/crates/workspace/src/searchable.rs b/crates/workspace/src/searchable.rsindex 72117e1cabb..7a470db7c92 100644--- a/crates/workspace/src/searchable.rs+++ b/crates/workspace/src/searchable.rs@@ -259,7 +259,7 @@ impl<T: SearchableItem> WeakSearchableItemHandle for WeakViewHandle<T> {impl PartialEq for Box<dyn WeakSearchableItemHandle> {fn eq(&self, other: &Self) -> bool {- self.id() == other.id() && self.window_id() == other.window_id()+ self.id() == other.id() && self.window() == other.window()}}@@ -267,6 +267,6 @@ impl Eq for Box<dyn WeakSearchableItemHandle> {}impl std::hash::Hash for Box<dyn WeakSearchableItemHandle> {fn hash<H: std::hash::Hasher>(&self, state: &mut H) {- (self.id(), self.window_id()).hash(state)+ (self.id(), self.window().id()).hash(state)}}