Wire up NewFile action

This commit is contained in:
Marshall Bowers 2023-12-05 20:21:35 -05:00
parent d2fe9f8f9b
commit d8757845a9

View file

@ -92,6 +92,7 @@ use std::{
ops::{ControlFlow, Deref, DerefMut, Range, RangeInclusive},
path::Path,
sync::Arc,
sync::Weak,
time::{Duration, Instant},
};
pub use sum_tree::Bias;
@ -420,6 +421,16 @@ pub fn init(cx: &mut AppContext) {
},
)
.detach();
cx.on_action(move |_: &workspace::NewFile, cx| {
let app_state = cx.global::<Weak<workspace::AppState>>();
if let Some(app_state) = app_state.upgrade() {
workspace::open_new(&app_state, cx, |workspace, cx| {
Editor::new_file(workspace, &Default::default(), cx)
})
.detach();
}
});
}
trait InvalidationRegion {