mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-09 10:56:20 +00:00
Wire up NewFile
action
This commit is contained in:
parent
d2fe9f8f9b
commit
d8757845a9
1 changed files with 11 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue