`text_hover_view` --> `ContextPillHover::new_text` Release Notes: - N/A
This commit is contained in:
parent
ef33666701
commit
b41ffae161
1 changed files with 15 additions and 15 deletions
|
@ -491,7 +491,7 @@ impl AddedContext {
|
||||||
let thread = handle.thread.clone();
|
let thread = handle.thread.clone();
|
||||||
Some(Rc::new(move |_, cx| {
|
Some(Rc::new(move |_, cx| {
|
||||||
let text = thread.read(cx).latest_detailed_summary_or_text();
|
let text = thread.read(cx).latest_detailed_summary_or_text();
|
||||||
text_hover_view(text.clone(), cx).into()
|
ContextPillHover::new_text(text.clone(), cx).into()
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
handle: AgentContextHandle::Thread(handle),
|
handle: AgentContextHandle::Thread(handle),
|
||||||
|
@ -509,7 +509,7 @@ impl AddedContext {
|
||||||
render_hover: {
|
render_hover: {
|
||||||
let text = context.text.clone();
|
let text = context.text.clone();
|
||||||
Some(Rc::new(move |_, cx| {
|
Some(Rc::new(move |_, cx| {
|
||||||
text_hover_view(text.clone(), cx).into()
|
ContextPillHover::new_text(text.clone(), cx).into()
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
handle: AgentContextHandle::Thread(context.handle.clone()),
|
handle: AgentContextHandle::Thread(context.handle.clone()),
|
||||||
|
@ -554,7 +554,7 @@ impl AddedContext {
|
||||||
render_hover: {
|
render_hover: {
|
||||||
let text = context.text.clone();
|
let text = context.text.clone();
|
||||||
Some(Rc::new(move |_, cx| {
|
Some(Rc::new(move |_, cx| {
|
||||||
text_hover_view(text.clone(), cx).into()
|
ContextPillHover::new_text(text.clone(), cx).into()
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
handle: AgentContextHandle::Rules(context.handle.clone()),
|
handle: AgentContextHandle::Rules(context.handle.clone()),
|
||||||
|
@ -670,18 +670,6 @@ impl ContextFileExcerpt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn text_hover_view(content: SharedString, cx: &mut App) -> Entity<ContextPillHover> {
|
|
||||||
ContextPillHover::new(cx, move |_, _| {
|
|
||||||
div()
|
|
||||||
.id("context-pill-hover-contents")
|
|
||||||
.overflow_scroll()
|
|
||||||
.max_w_128()
|
|
||||||
.max_h_96()
|
|
||||||
.child(content.clone())
|
|
||||||
.into_any_element()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ContextPillHover {
|
struct ContextPillHover {
|
||||||
render_hover: Box<dyn Fn(&mut Window, &mut App) -> AnyElement>,
|
render_hover: Box<dyn Fn(&mut Window, &mut App) -> AnyElement>,
|
||||||
}
|
}
|
||||||
|
@ -695,6 +683,18 @@ impl ContextPillHover {
|
||||||
render_hover: Box::new(render_hover),
|
render_hover: Box::new(render_hover),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn new_text(content: SharedString, cx: &mut App) -> Entity<Self> {
|
||||||
|
Self::new(cx, move |_, _| {
|
||||||
|
div()
|
||||||
|
.id("context-pill-hover-contents")
|
||||||
|
.overflow_scroll()
|
||||||
|
.max_w_128()
|
||||||
|
.max_h_96()
|
||||||
|
.child(content.clone())
|
||||||
|
.into_any_element()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for ContextPillHover {
|
impl Render for ContextPillHover {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue