Wire up inline assist quick action
This commit is contained in:
parent
147c99f1a7
commit
d711087529
3 changed files with 15 additions and 11 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -7117,6 +7117,7 @@ dependencies = [
|
||||||
name = "quick_action_bar2"
|
name = "quick_action_bar2"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"assistant2",
|
||||||
"editor2",
|
"editor2",
|
||||||
"gpui2",
|
"gpui2",
|
||||||
"search2",
|
"search2",
|
||||||
|
|
|
@ -9,7 +9,7 @@ path = "src/quick_action_bar.rs"
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
#assistant = { path = "../assistant" }
|
assistant = { package = "assistant2", path = "../assistant2" }
|
||||||
editor = { package = "editor2", path = "../editor2" }
|
editor = { package = "editor2", path = "../editor2" }
|
||||||
gpui = { package = "gpui2", path = "../gpui2" }
|
gpui = { package = "gpui2", path = "../gpui2" }
|
||||||
search = { package = "search2", path = "../search2" }
|
search = { package = "search2", path = "../search2" }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// use assistant::{assistant_panel::InlineAssist, AssistantPanel};
|
use assistant::{AssistantPanel, InlineAssist};
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
|
@ -15,7 +15,6 @@ pub struct QuickActionBar {
|
||||||
buffer_search_bar: View<BufferSearchBar>,
|
buffer_search_bar: View<BufferSearchBar>,
|
||||||
active_item: Option<Box<dyn ItemHandle>>,
|
active_item: Option<Box<dyn ItemHandle>>,
|
||||||
_inlay_hints_enabled_subscription: Option<Subscription>,
|
_inlay_hints_enabled_subscription: Option<Subscription>,
|
||||||
#[allow(unused)]
|
|
||||||
workspace: WeakView<Workspace>,
|
workspace: WeakView<Workspace>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,21 +55,25 @@ impl Render for QuickActionBar {
|
||||||
"toggle inline assistant",
|
"toggle inline assistant",
|
||||||
Icon::MagicWand,
|
Icon::MagicWand,
|
||||||
false,
|
false,
|
||||||
Box::new(gpui::NoAction),
|
Box::new(InlineAssist),
|
||||||
"Inline assistant",
|
"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()
|
h_stack()
|
||||||
.id("quick action bar")
|
.id("quick action bar")
|
||||||
.p_1()
|
.p_1()
|
||||||
.gap_2()
|
.gap_2()
|
||||||
.child(search_button)
|
.child(search_button)
|
||||||
.child(
|
.child(assistant_button)
|
||||||
div()
|
|
||||||
.border()
|
|
||||||
.border_color(gpui::red())
|
|
||||||
.child(assistant_button),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue