Use the same InlineAssist
action between both assistant
and assistant2
(#22126)
This PR makes it so `assistant` and `assistant2` both use the same action for inline assist (`zed_actions::InlineAssist`). This makes it so the keybindings to deploy the inline assist seamlessly swap based on the feature flag without needing to rebind them. One minor caveat: if you're using `assistant2` the action name in the command palette will be `assistant: inline assist`. Release Notes: - N/A
This commit is contained in:
parent
80431e5518
commit
3052fc2565
5 changed files with 29 additions and 11 deletions
|
@ -8,7 +8,7 @@ use crate::{
|
|||
prompts::PromptBuilder,
|
||||
streaming_diff::{CharOperation, LineDiff, LineOperation, StreamingDiff},
|
||||
terminal_inline_assistant::TerminalInlineAssistant,
|
||||
CycleNextInlineAssist, CyclePreviousInlineAssist, ToggleInlineAssist,
|
||||
CycleNextInlineAssist, CyclePreviousInlineAssist,
|
||||
};
|
||||
use crate::{AssistantPanel, ToggleContextPicker};
|
||||
use anyhow::{Context as _, Result};
|
||||
|
@ -75,9 +75,7 @@ pub fn init(
|
|||
cx: &mut AppContext,
|
||||
) {
|
||||
cx.set_global(InlineAssistant::new(fs, prompt_builder, telemetry));
|
||||
cx.observe_new_views(|workspace: &mut Workspace, cx| {
|
||||
workspace.register_action(InlineAssistant::toggle_inline_assist);
|
||||
|
||||
cx.observe_new_views(|_workspace: &mut Workspace, cx| {
|
||||
let workspace = cx.view().clone();
|
||||
InlineAssistant::update_global(cx, |inline_assistant, cx| {
|
||||
inline_assistant.register_workspace(&workspace, cx)
|
||||
|
@ -204,9 +202,9 @@ impl InlineAssistant {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn toggle_inline_assist(
|
||||
pub fn inline_assist(
|
||||
workspace: &mut Workspace,
|
||||
_action: &ToggleInlineAssist,
|
||||
_action: &zed_actions::InlineAssist,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) {
|
||||
let settings = AssistantSettings::get_global(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue