assistant2: Add live context type and use in message editor (#22865)
Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
parent
5d8ef94c86
commit
a0fca24e3f
15 changed files with 359 additions and 182 deletions
|
@ -3,12 +3,12 @@ use std::rc::Rc;
|
|||
use gpui::ClickEvent;
|
||||
use ui::{prelude::*, IconButtonShape, Tooltip};
|
||||
|
||||
use crate::context::{Context, ContextKind};
|
||||
use crate::context::{ContextKind, ContextSnapshot};
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub enum ContextPill {
|
||||
Added {
|
||||
context: Context,
|
||||
context: ContextSnapshot,
|
||||
dupe_name: bool,
|
||||
on_remove: Option<Rc<dyn Fn(&ClickEvent, &mut WindowContext)>>,
|
||||
},
|
||||
|
@ -21,7 +21,7 @@ pub enum ContextPill {
|
|||
|
||||
impl ContextPill {
|
||||
pub fn new_added(
|
||||
context: Context,
|
||||
context: ContextSnapshot,
|
||||
dupe_name: bool,
|
||||
on_remove: Option<Rc<dyn Fn(&ClickEvent, &mut WindowContext)>>,
|
||||
) -> Self {
|
||||
|
@ -49,10 +49,10 @@ impl ContextPill {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> &ContextKind {
|
||||
pub fn kind(&self) -> ContextKind {
|
||||
match self {
|
||||
Self::Added { context, .. } => &context.kind,
|
||||
Self::Suggested { kind, .. } => kind,
|
||||
Self::Added { context, .. } => context.kind,
|
||||
Self::Suggested { kind, .. } => *kind,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue