assistant2: Change model selector keybinding and make it visible (#22965)
We weren't showing the keybinding in none of the places where the model selector was visible. Also, I took advantage of the opportunity to change the keybinding for two reasons: 1. `cmd-shift-m` caused conflict if on an editor (inline assistant case) 2. `cmd-opt-/` is the one Cursor uses; so consistency with something that might be already consolidated sounds like a low-hanging fruit | Editor Inline Assist | Terminal Inline Assist | Assistant Panel | |--------|--------|--------| | <img width="1336" alt="Screenshot 2025-01-10 at 11 01 24 AM" src="https://github.com/user-attachments/assets/0782f217-025f-4bc0-b2fa-64b3524c968b" /> | <img width="1336" alt="Screenshot 2025-01-10 at 11 01 29 AM" src="https://github.com/user-attachments/assets/d05a3b5c-33fd-4593-b1d8-aa9944de816a" /> | <img width="1336" alt="Screenshot 2025-01-10 at 11 01 33 AM" src="https://github.com/user-attachments/assets/8cb075e7-ccde-46f5-aa05-d20a9d42b286" /> | Release Notes: - N/A
This commit is contained in:
parent
a267911e83
commit
9248458928
5 changed files with 28 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
use fs::Fs;
|
||||
use gpui::View;
|
||||
use gpui::{FocusHandle, View};
|
||||
use language_model::LanguageModelRegistry;
|
||||
use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu};
|
||||
use settings::update_settings_file;
|
||||
|
@ -11,12 +11,14 @@ use crate::{assistant_settings::AssistantSettings, ToggleModelSelector};
|
|||
pub struct AssistantModelSelector {
|
||||
selector: View<LanguageModelSelector>,
|
||||
menu_handle: PopoverMenuHandle<LanguageModelSelector>,
|
||||
focus_handle: FocusHandle,
|
||||
}
|
||||
|
||||
impl AssistantModelSelector {
|
||||
pub(crate) fn new(
|
||||
fs: Arc<dyn Fs>,
|
||||
menu_handle: PopoverMenuHandle<LanguageModelSelector>,
|
||||
focus_handle: FocusHandle,
|
||||
cx: &mut WindowContext,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -34,6 +36,7 @@ impl AssistantModelSelector {
|
|||
)
|
||||
}),
|
||||
menu_handle,
|
||||
focus_handle,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +44,7 @@ impl AssistantModelSelector {
|
|||
impl Render for AssistantModelSelector {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let active_model = LanguageModelRegistry::read_global(cx).active_model();
|
||||
let focus_handle = self.selector.focus_handle(cx).clone();
|
||||
let focus_handle = self.focus_handle.clone();
|
||||
|
||||
LanguageModelSelectorPopoverMenu::new(
|
||||
self.selector.clone(),
|
||||
|
@ -49,7 +52,6 @@ impl Render for AssistantModelSelector {
|
|||
.style(ButtonStyle::Subtle)
|
||||
.child(
|
||||
h_flex()
|
||||
.w_full()
|
||||
.gap_0p5()
|
||||
.child(
|
||||
div()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue