assistant: Improve discoverability of terminal inline assist (#15431)
This adds a button to the terminal tab bar: <img width="444" alt="image" src="https://github.com/user-attachments/assets/71baadae-0ecf-493f-853c-34d4d6a48310"> Release Notes: - N/A
This commit is contained in:
parent
de8f0ce861
commit
f6012cd86e
2 changed files with 102 additions and 58 deletions
|
@ -94,6 +94,31 @@ pub fn init(cx: &mut AppContext) {
|
|||
},
|
||||
)
|
||||
.detach();
|
||||
|
||||
cx.observe_new_views(
|
||||
|terminal_panel: &mut TerminalPanel, cx: &mut ViewContext<TerminalPanel>| {
|
||||
let settings = AssistantSettings::get_global(cx);
|
||||
if !settings.enabled {
|
||||
return;
|
||||
}
|
||||
|
||||
terminal_panel.register_tab_bar_button(cx.new_view(|_| InlineAssistTabBarButton), cx);
|
||||
},
|
||||
)
|
||||
.detach();
|
||||
}
|
||||
|
||||
struct InlineAssistTabBarButton;
|
||||
|
||||
impl Render for InlineAssistTabBarButton {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
IconButton::new("terminal_inline_assistant", IconName::MagicWand)
|
||||
.icon_size(IconSize::Small)
|
||||
.on_click(cx.listener(|_, _, cx| {
|
||||
cx.dispatch_action(InlineAssist::default().boxed_clone());
|
||||
}))
|
||||
.tooltip(move |cx| Tooltip::for_action("Inline Assist", &InlineAssist::default(), cx))
|
||||
}
|
||||
}
|
||||
|
||||
pub enum AssistantPanelEvent {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue