Wire up inline assist quick action

Marshall Bowers created

Change summary

Cargo.lock                                       |  1 
crates/quick_action_bar2/Cargo.toml              |  2 
crates/quick_action_bar2/src/quick_action_bar.rs | 23 ++++++++++-------
3 files changed, 15 insertions(+), 11 deletions(-)

Detailed changes

Cargo.lock 🔗

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

crates/quick_action_bar2/Cargo.toml 🔗

@@ -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" }

crates/quick_action_bar2/src/quick_action_bar.rs 🔗

@@ -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)
     }
 }