mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
Allow worktrees to be joined with no open window
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
58bae3a9a7
commit
59d61d33cb
1 changed files with 14 additions and 0 deletions
|
@ -31,6 +31,7 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
cx.add_global_action("workspace:open", open);
|
||||
cx.add_global_action("workspace:open_paths", open_paths);
|
||||
cx.add_global_action("workspace:new_file", open_new);
|
||||
cx.add_global_action("workspace:join_worktree", join_worktree);
|
||||
cx.add_action("workspace:save", Workspace::save_active_item);
|
||||
cx.add_action("workspace:debug_elements", Workspace::debug_elements);
|
||||
cx.add_action("workspace:new_file", Workspace::open_new_file);
|
||||
|
@ -114,6 +115,19 @@ fn open_new(app_state: &Arc<AppState>, cx: &mut MutableAppContext) {
|
|||
});
|
||||
}
|
||||
|
||||
fn join_worktree(app_state: &Arc<AppState>, cx: &mut MutableAppContext) {
|
||||
cx.add_window(|cx| {
|
||||
let mut view = Workspace::new(
|
||||
app_state.settings.clone(),
|
||||
app_state.languages.clone(),
|
||||
app_state.rpc.clone(),
|
||||
cx,
|
||||
);
|
||||
view.join_worktree(&app_state, cx);
|
||||
view
|
||||
});
|
||||
}
|
||||
|
||||
pub trait Item: Entity + Sized {
|
||||
type View: ItemView;
|
||||
|
||||
|
|
Loading…
Reference in a new issue