Set up editor actions after workspace not on stack (#20445)

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad@zed.dev>
This commit is contained in:
Kyle Kelley 2024-11-08 17:11:43 -08:00 committed by GitHub
parent 72125949d9
commit 1f974d074e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 29 deletions

View file

@ -61,8 +61,10 @@ pub fn init(cx: &mut AppContext) {
return;
}
let is_local_project = editor
.workspace()
cx.defer(|editor, cx| {
let workspace = Workspace::for_window(cx);
let is_local_project = workspace
.map(|workspace| workspace.read(cx).project().read(cx).is_local())
.unwrap_or(false);
@ -97,6 +99,7 @@ pub fn init(cx: &mut AppContext) {
}
})
.detach();
});
})
.detach();
}

View file

@ -4547,6 +4547,11 @@ impl Workspace {
.children(leader_border),
)
}
pub fn for_window(cx: &mut WindowContext) -> Option<View<Workspace>> {
let window = cx.window_handle().downcast::<Workspace>()?;
cx.read_window(&window, |workspace, _| workspace).ok()
}
}
fn leader_border_for_pane(