assistant2: Add create buffer tool (#11219)
This PR adds a new tool to the `assistant2` crate that allows the assistant to create a new buffer with some content. Release Notes: - N/A --------- Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
parent
ada2791fa3
commit
d01428e69c
10 changed files with 173 additions and 27 deletions
|
@ -218,7 +218,7 @@ impl TestAppContext {
|
|||
/// Adds a new window, and returns its root view and a `VisualTestContext` which can be used
|
||||
/// as a `WindowContext` for the rest of the test. Typically you would shadow this context with
|
||||
/// the returned one. `let (view, cx) = cx.add_window_view(...);`
|
||||
pub fn add_window_view<F, V>(&mut self, build_window: F) -> (View<V>, &mut VisualTestContext)
|
||||
pub fn add_window_view<F, V>(&mut self, build_root_view: F) -> (View<V>, &mut VisualTestContext)
|
||||
where
|
||||
F: FnOnce(&mut ViewContext<V>) -> V,
|
||||
V: 'static + Render,
|
||||
|
@ -230,7 +230,7 @@ impl TestAppContext {
|
|||
bounds: Some(bounds),
|
||||
..Default::default()
|
||||
},
|
||||
|cx| cx.new_view(build_window),
|
||||
|cx| cx.new_view(build_root_view),
|
||||
);
|
||||
drop(cx);
|
||||
let view = window.root_view(self).unwrap();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use crate::Empty;
|
||||
use crate::{
|
||||
seal::Sealed, AnyElement, AnyModel, AnyWeakModel, AppContext, Bounds, ContentMask, Element,
|
||||
ElementId, Entity, EntityId, Flatten, FocusHandle, FocusableView, GlobalElementId, IntoElement,
|
||||
|
@ -457,3 +458,12 @@ mod any_view {
|
|||
view.update(cx, |view, cx| view.render(cx).into_any_element())
|
||||
}
|
||||
}
|
||||
|
||||
/// A view that renders nothing
|
||||
pub struct EmptyView;
|
||||
|
||||
impl Render for EmptyView {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
Empty
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue