Wire up AssistantPanelDelegate based on assistant2 feature flag (#23444)
This PR adjusts how the `AssistantPanelDelegate` global is set to be based on the state of the feature flag. This should prevent `assistant` and `assistant2` from potentially clobbering each other. Release Notes: - N/A
This commit is contained in:
@@ -12,6 +12,7 @@ pub(crate) mod windows_only_instance;
|
||||
use anyhow::Context as _;
|
||||
pub use app_menus::*;
|
||||
use assets::Assets;
|
||||
use assistant_context_editor::AssistantPanelDelegate;
|
||||
use breadcrumbs::Breadcrumbs;
|
||||
use client::{zed_urls, ZED_URL_SCHEME};
|
||||
use collections::VecDeque;
|
||||
@@ -458,10 +459,20 @@ fn initialize_panels(prompt_builder: Arc<PromptBuilder>, cx: &mut ViewContext<Wo
|
||||
//
|
||||
// Once we ship `assistant2` we can push this back down into `assistant2::assistant_panel::init`.
|
||||
if is_assistant2_enabled {
|
||||
<dyn AssistantPanelDelegate>::set_global(
|
||||
Arc::new(assistant2::ConcreteAssistantPanelDelegate),
|
||||
cx,
|
||||
);
|
||||
|
||||
workspace
|
||||
.register_action(assistant2::AssistantPanel::toggle_focus)
|
||||
.register_action(assistant2::InlineAssistant::inline_assist);
|
||||
} else {
|
||||
<dyn AssistantPanelDelegate>::set_global(
|
||||
Arc::new(assistant::assistant_panel::ConcreteAssistantPanelDelegate),
|
||||
cx,
|
||||
);
|
||||
|
||||
workspace
|
||||
.register_action(assistant::AssistantPanel::toggle_focus)
|
||||
.register_action(assistant::AssistantPanel::inline_assist);
|
||||
|
||||
Reference in New Issue
Block a user