From 4e818fed4a68402bb4040262c2f4e253f7f5f456 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 8 Sep 2023 11:20:49 +0200 Subject: [PATCH] Make channel notes act as an editor to enable inline assistant --- crates/collab_ui/src/channel_view.rs | 17 ++++++++++++++++- crates/workspace/src/item.rs | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/collab_ui/src/channel_view.rs b/crates/collab_ui/src/channel_view.rs index 5086cc8b37..a09073c55d 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, + _: &'a AppContext, + ) -> Option<&'a AnyViewHandle> { + if type_id == TypeId::of::() { + Some(self_handle) + } else if type_id == TypeId::of::() { + Some(&self.editor) + } else { + None + } + } + fn tab_content( &self, _: Option, diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs index c218a85234..4e24c831f4 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) -> Option> { None }