mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 12:38:02 +00:00
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:
parent
72125949d9
commit
1f974d074e
2 changed files with 37 additions and 29 deletions
|
@ -61,42 +61,45 @@ pub fn init(cx: &mut AppContext) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_local_project = editor
|
cx.defer(|editor, cx| {
|
||||||
.workspace()
|
let workspace = Workspace::for_window(cx);
|
||||||
.map(|workspace| workspace.read(cx).project().read(cx).is_local())
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
if !is_local_project {
|
let is_local_project = workspace
|
||||||
return;
|
.map(|workspace| workspace.read(cx).project().read(cx).is_local())
|
||||||
}
|
.unwrap_or(false);
|
||||||
|
|
||||||
let editor_handle = cx.view().downgrade();
|
if !is_local_project {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
editor
|
let editor_handle = cx.view().downgrade();
|
||||||
.register_action({
|
|
||||||
let editor_handle = editor_handle.clone();
|
editor
|
||||||
move |_: &Run, cx| {
|
.register_action({
|
||||||
if !JupyterSettings::enabled(cx) {
|
let editor_handle = editor_handle.clone();
|
||||||
return;
|
move |_: &Run, cx| {
|
||||||
|
if !JupyterSettings::enabled(cx) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
crate::run(editor_handle.clone(), true, cx).log_err();
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
|
||||||
crate::run(editor_handle.clone(), true, cx).log_err();
|
editor
|
||||||
}
|
.register_action({
|
||||||
})
|
let editor_handle = editor_handle.clone();
|
||||||
.detach();
|
move |_: &RunInPlace, cx| {
|
||||||
|
if !JupyterSettings::enabled(cx) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
editor
|
crate::run(editor_handle.clone(), false, cx).log_err();
|
||||||
.register_action({
|
|
||||||
let editor_handle = editor_handle.clone();
|
|
||||||
move |_: &RunInPlace, cx| {
|
|
||||||
if !JupyterSettings::enabled(cx) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
crate::run(editor_handle.clone(), false, cx).log_err();
|
.detach();
|
||||||
}
|
});
|
||||||
})
|
|
||||||
.detach();
|
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4547,6 +4547,11 @@ impl Workspace {
|
||||||
.children(leader_border),
|
.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(
|
fn leader_border_for_pane(
|
||||||
|
|
Loading…
Reference in a new issue