assistant2: Allow creating a new thread via the command palette (#22168)
This PR allows a new thread to be created via the command palette when the Assistant2 panel is not focused. Release Notes: - N/A
This commit is contained in:
parent
5b2653a1d1
commit
918866b7de
1 changed files with 10 additions and 3 deletions
|
@ -27,9 +27,16 @@ use crate::{NewThread, OpenHistory, ToggleFocus};
|
||||||
pub fn init(cx: &mut AppContext) {
|
pub fn init(cx: &mut AppContext) {
|
||||||
cx.observe_new_views(
|
cx.observe_new_views(
|
||||||
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
|
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
|
||||||
workspace.register_action(|workspace, _: &ToggleFocus, cx| {
|
workspace
|
||||||
workspace.toggle_panel_focus::<AssistantPanel>(cx);
|
.register_action(|workspace, _: &ToggleFocus, cx| {
|
||||||
});
|
workspace.toggle_panel_focus::<AssistantPanel>(cx);
|
||||||
|
})
|
||||||
|
.register_action(|workspace, _: &NewThread, cx| {
|
||||||
|
if let Some(panel) = workspace.panel::<AssistantPanel>(cx) {
|
||||||
|
panel.update(cx, |panel, cx| panel.new_thread(cx));
|
||||||
|
workspace.focus_panel::<AssistantPanel>(cx);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.detach();
|
.detach();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue