Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Make channel notes act as an editor to enable inline assistant

Antonio Scandurra4e818fed4a68
diff --git a/crates/collab_ui/src/channel_view.rs b/crates/collab_ui/src/channel_view.rs
index 5086cc8b377..a09073c55d3 100644
--- a/crates/collab_ui/src/channel_view.rs
+++ b/crates/collab_ui/src/channel_view.rs
@@ -15,7 +15,7 @@ use gpui::{
ViewContext, ViewHandle,
};
use project::Project;
-use std::any::Any;
+use std::any::{Any, TypeId};
use workspace::{
item::{FollowableItem, Item, ItemHandle},
register_followable_item,
@@ -189,6 +189,21 @@ impl View for ChannelView {
}
impl Item for ChannelView {
+ fn act_as_type<'a>(
+ &'a self,
+ type_id: TypeId,
+ self_handle: &'a ViewHandle<Self>,
+ _: &'a AppContext,
+ ) -> Option<&'a AnyViewHandle> {
+ if type_id == TypeId::of::<Self>() {
+ Some(self_handle)
+ } else if type_id == TypeId::of::<Editor>() {
+ Some(&self.editor)
+ } else {
+ None
+ }
+ }
+
fn tab_content<V: 'static>(
&self,
_: Option<usize>,
diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs
index c218a852349..4e24c831f41 100644
--- a/crates/workspace/src/item.rs
+++ b/crates/workspace/src/item.rs
@@ -171,6 +171,7 @@ pub trait Item: View {
None
}
}
+
fn as_searchable(&self, _: &ViewHandle<Self>) -> Option<Box<dyn SearchableItemHandle>> {
None
}