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
|
@ -15,9 +15,9 @@ mod thread_history;
|
|||
mod thread_store;
|
||||
mod ui;
|
||||
|
||||
use std::any::TypeId;
|
||||
use std::sync::Arc;
|
||||
|
||||
use assistant_settings::AssistantSettings;
|
||||
use client::Client;
|
||||
use command_palette_hooks::CommandPaletteFilter;
|
||||
use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt};
|
||||
|
@ -28,6 +28,8 @@ use settings::Settings as _;
|
|||
use util::ResultExt;
|
||||
|
||||
pub use crate::assistant_panel::AssistantPanel;
|
||||
use crate::assistant_settings::AssistantSettings;
|
||||
pub use crate::inline_assistant::InlineAssistant;
|
||||
|
||||
actions!(
|
||||
assistant2,
|
||||
|
@ -38,7 +40,6 @@ actions!(
|
|||
ToggleModelSelector,
|
||||
OpenHistory,
|
||||
Chat,
|
||||
ToggleInlineAssist,
|
||||
CycleNextInlineAssist,
|
||||
CyclePreviousInlineAssist
|
||||
]
|
||||
|
@ -80,6 +81,8 @@ pub fn init(fs: Arc<dyn Fs>, client: Arc<Client>, stdout_is_a_pty: bool, cx: &mu
|
|||
fn feature_gate_assistant2_actions(cx: &mut AppContext) {
|
||||
const ASSISTANT1_NAMESPACE: &str = "assistant";
|
||||
|
||||
let inline_assist_actions = [TypeId::of::<zed_actions::InlineAssist>()];
|
||||
|
||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
||||
filter.hide_namespace(NAMESPACE);
|
||||
});
|
||||
|
@ -89,6 +92,11 @@ fn feature_gate_assistant2_actions(cx: &mut AppContext) {
|
|||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
||||
filter.show_namespace(NAMESPACE);
|
||||
filter.hide_namespace(ASSISTANT1_NAMESPACE);
|
||||
|
||||
// We're hiding all of the `assistant: ` actions, but we want to
|
||||
// keep the inline assist action around so we can use the same
|
||||
// one in Assistant2.
|
||||
filter.show_action_types(inline_assist_actions.iter());
|
||||
});
|
||||
} else {
|
||||
CommandPaletteFilter::update_global(cx, |filter, _cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue