Skip to content

Commit

Permalink
assistant2: Allow creating a new thread via the command palette (#22168)
Browse files Browse the repository at this point in the history
This PR allows a new thread to be created via the command palette when
the Assistant2 panel is not focused.

Release Notes:

- N/A
  • Loading branch information
maxdeviant authored Dec 17, 2024
1 parent 5b2653a commit 918866b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/assistant2/src/assistant_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ use crate::{NewThread, OpenHistory, ToggleFocus};
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
workspace.register_action(|workspace, _: &ToggleFocus, cx| {
workspace.toggle_panel_focus::<AssistantPanel>(cx);
});
workspace
.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();
Expand Down

0 comments on commit 918866b

Please sign in to comment.