Wire up inline assist quick action

This commit is contained in:
Marshall Bowers 2023-12-06 15:44:50 -05:00
parent 147c99f1a7
commit d711087529
3 changed files with 15 additions and 11 deletions

1
Cargo.lock generated
View File

@ -7117,6 +7117,7 @@ dependencies = [
name = "quick_action_bar2"
version = "0.1.0"
dependencies = [
"assistant2",
"editor2",
"gpui2",
"search2",

View File

@ -9,7 +9,7 @@ path = "src/quick_action_bar.rs"
doctest = false
[dependencies]
#assistant = { path = "../assistant" }
assistant = { package = "assistant2", path = "../assistant2" }
editor = { package = "editor2", path = "../editor2" }
gpui = { package = "gpui2", path = "../gpui2" }
search = { package = "search2", path = "../search2" }

View File

@ -1,4 +1,4 @@
// use assistant::{assistant_panel::InlineAssist, AssistantPanel};
use assistant::{AssistantPanel, InlineAssist};
use editor::Editor;
use gpui::{
@ -15,7 +15,6 @@ pub struct QuickActionBar {
buffer_search_bar: View<BufferSearchBar>,
active_item: Option<Box<dyn ItemHandle>>,
_inlay_hints_enabled_subscription: Option<Subscription>,
#[allow(unused)]
workspace: WeakView<Workspace>,
}
@ -56,21 +55,25 @@ impl Render for QuickActionBar {
"toggle inline assistant",
Icon::MagicWand,
false,
Box::new(gpui::NoAction),
Box::new(InlineAssist),
"Inline assistant",
|_, _cx| todo!(),
{
let workspace = self.workspace.clone();
move |_, cx| {
if let Some(workspace) = workspace.upgrade() {
workspace.update(cx, |workspace, cx| {
AssistantPanel::inline_assist(workspace, &InlineAssist, cx);
});
}
}
},
);
h_stack()
.id("quick action bar")
.p_1()
.gap_2()
.child(search_button)
.child(
div()
.border()
.border_color(gpui::red())
.child(assistant_button),
)
.child(assistant_button)
}
}