From 0154b6c68e76752a0cbdedcb156e862b8e18120a Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 17 Dec 2024 13:17:34 -0500 Subject: [PATCH] Allow both Assistants to be used when in the `assistant2` feature flag --- crates/zed/src/zed.rs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 7372ffea1103f..a6d87c783e514 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -240,7 +240,6 @@ pub fn initialize_workspace( let git_ui_feature_flag = cx.wait_for_flag::(); let prompt_builder = prompt_builder.clone(); - let is_staff = cx.is_staff(); cx.spawn(|workspace_handle, mut cx| async move { let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone()); @@ -254,6 +253,8 @@ pub fn initialize_workspace( workspace_handle.clone(), cx.clone(), ); + let assistant_panel = + assistant::AssistantPanel::load(workspace_handle.clone(), prompt_builder, cx.clone()); let ( project_panel, @@ -262,6 +263,7 @@ pub fn initialize_workspace( channels_panel, chat_panel, notification_panel, + assistant_panel, ) = futures::try_join!( project_panel, outline_panel, @@ -269,6 +271,7 @@ pub fn initialize_workspace( channels_panel, chat_panel, notification_panel, + assistant_panel, )?; workspace_handle.update(&mut cx, |workspace, cx| { @@ -278,15 +281,15 @@ pub fn initialize_workspace( workspace.add_panel(channels_panel, cx); workspace.add_panel(chat_panel, cx); workspace.add_panel(notification_panel, cx); + workspace.add_panel(assistant_panel, cx); })?; - let git_ui_enabled = git_ui_feature_flag.await || is_staff; + let git_ui_enabled = git_ui_feature_flag.await; let git_panel = if git_ui_enabled { Some(git_ui::git_panel::GitPanel::load(workspace_handle.clone(), cx.clone()).await?) } else { None }; - workspace_handle.update(&mut cx, |workspace, cx| { if let Some(git_panel) = git_panel { workspace.add_panel(git_panel, cx); @@ -299,27 +302,20 @@ pub fn initialize_workspace( } else { assistant2_feature_flag.await }; - - let (assistant_panel, assistant2_panel) = if is_assistant2_enabled { - let assistant2_panel = - assistant2::AssistantPanel::load(workspace_handle.clone(), cx.clone()).await?; - - (None, Some(assistant2_panel)) + let assistant2_panel = if is_assistant2_enabled { + Some(assistant2::AssistantPanel::load(workspace_handle.clone(), cx.clone()).await?) } else { - let assistant_panel = - assistant::AssistantPanel::load(workspace_handle.clone(), prompt_builder, cx.clone()).await?; - - (Some(assistant_panel), None) + None }; workspace_handle.update(&mut cx, |workspace, cx| { - if let Some(assistant_panel) = assistant_panel { - workspace.add_panel(assistant_panel, cx); - workspace.register_action(assistant::AssistantPanel::inline_assist); - } - if let Some(assistant2_panel) = assistant2_panel { workspace.add_panel(assistant2_panel, cx); + } + + if is_assistant2_enabled { workspace.register_action(assistant2::InlineAssistant::inline_assist); + } else { + workspace.register_action(assistant::AssistantPanel::inline_assist); } }) })