Consolidate Assistant panels in assistant2
feature flag (#23442)
This PR consolidates the two Assistant panels into one for users in the `assistant2` feature flag. Now that the Assistant1 prompt editor is accessible through the Assistant2 panel, we no longer have a need to show both panels. Release Notes: - N/A
This commit is contained in:
parent
7516b8c8b7
commit
c887bf8e54
14 changed files with 89 additions and 51 deletions
|
@ -31,7 +31,6 @@ use crate::slash_command_settings::SlashCommandSettings;
|
|||
actions!(
|
||||
assistant,
|
||||
[
|
||||
ToggleFocus,
|
||||
InsertActivePrompt,
|
||||
DeployHistory,
|
||||
DeployPromptLibrary,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
terminal_inline_assistant::TerminalInlineAssistant, DeployHistory, DeployPromptLibrary,
|
||||
InlineAssistant, NewContext, ToggleFocus,
|
||||
InlineAssistant, NewContext,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use assistant_context_editor::{
|
||||
|
@ -42,7 +42,7 @@ use workspace::{
|
|||
item::Item,
|
||||
pane, DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace,
|
||||
};
|
||||
use zed_actions::InlineAssist;
|
||||
use zed_actions::assistant::{InlineAssist, ToggleFocus};
|
||||
|
||||
pub fn init(cx: &mut AppContext) {
|
||||
<dyn AssistantPanelDelegate>::set_global(Arc::new(ConcreteAssistantPanelDelegate), cx);
|
||||
|
@ -51,14 +51,6 @@ pub fn init(cx: &mut AppContext) {
|
|||
cx.observe_new_views(
|
||||
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
|
||||
workspace
|
||||
.register_action(|workspace, _: &ToggleFocus, cx| {
|
||||
let settings = AssistantSettings::get_global(cx);
|
||||
if !settings.enabled {
|
||||
return;
|
||||
}
|
||||
|
||||
workspace.toggle_panel_focus::<AssistantPanel>(cx);
|
||||
})
|
||||
.register_action(ContextEditor::quote_selection)
|
||||
.register_action(ContextEditor::insert_selection)
|
||||
.register_action(ContextEditor::copy_code)
|
||||
|
@ -341,6 +333,19 @@ impl AssistantPanel {
|
|||
this
|
||||
}
|
||||
|
||||
pub fn toggle_focus(
|
||||
workspace: &mut Workspace,
|
||||
_: &ToggleFocus,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) {
|
||||
let settings = AssistantSettings::get_global(cx);
|
||||
if !settings.enabled {
|
||||
return;
|
||||
}
|
||||
|
||||
workspace.toggle_panel_focus::<Self>(cx);
|
||||
}
|
||||
|
||||
fn watch_client_status(client: Arc<Client>, cx: &mut ViewContext<Self>) -> Task<()> {
|
||||
let mut status_rx = client.status();
|
||||
|
||||
|
|
|
@ -1728,7 +1728,7 @@ impl PromptEditor {
|
|||
}
|
||||
|
||||
fn placeholder_text(codegen: &Codegen, cx: &WindowContext) -> String {
|
||||
let context_keybinding = text_for_action(&crate::ToggleFocus, cx)
|
||||
let context_keybinding = text_for_action(&zed_actions::assistant::ToggleFocus, cx)
|
||||
.map(|keybinding| format!(" • {keybinding} for context"))
|
||||
.unwrap_or_default();
|
||||
|
||||
|
|
|
@ -740,7 +740,7 @@ impl PromptEditor {
|
|||
}
|
||||
|
||||
fn placeholder_text(cx: &WindowContext) -> String {
|
||||
let context_keybinding = text_for_action(&crate::ToggleFocus, cx)
|
||||
let context_keybinding = text_for_action(&zed_actions::assistant::ToggleFocus, cx)
|
||||
.map(|keybinding| format!(" • {keybinding} for context"))
|
||||
.unwrap_or_default();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue