Restore welcome page and several pickers

This commit is contained in:
Mikayla 2023-11-28 15:25:28 -08:00
parent d927c2f497
commit ed8e62cd18
No known key found for this signature in database
4 changed files with 63 additions and 69 deletions

View file

@ -166,7 +166,7 @@ fn main() {
// cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))
// .detach();
// watch_file_types(fs.clone(), cx);
watch_file_types(fs.clone(), cx);
languages.set_theme(cx.theme().clone());
cx.observe_global::<SettingsStore>({
@ -722,31 +722,33 @@ async fn watch_languages(fs: Arc<dyn fs::Fs>, languages: Arc<LanguageRegistry>)
Some(())
}
//todo!()
// #[cfg(debug_assertions)]
// fn watch_file_types(fs: Arc<dyn Fs>, cx: &mut AppContext) {
// cx.spawn(|mut cx| async move {
// let mut events = fs
// .watch(
// "assets/icons/file_icons/file_types.json".as_ref(),
// Duration::from_millis(100),
// )
// .await;
// while (events.next().await).is_some() {
// cx.update(|cx| {
// cx.update_global(|file_types, _| {
// *file_types = project_panel::file_associations::FileAssociations::new(Assets);
// });
// })
// }
// })
// .detach()
// }
#[cfg(debug_assertions)]
fn watch_file_types(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {
use std::time::Duration;
cx.spawn(|mut cx| async move {
let mut events = fs
.watch(
"assets/icons/file_icons/file_types.json".as_ref(),
Duration::from_millis(100),
)
.await;
while (events.next().await).is_some() {
cx.update(|cx| {
cx.update_global(|file_types, _| {
*file_types = project_panel::file_associations::FileAssociations::new(Assets);
});
})
.ok();
}
})
.detach()
}
#[cfg(not(debug_assertions))]
async fn watch_languages(_: Arc<dyn Fs>, _: Arc<LanguageRegistry>) -> Option<()> {
None
}
// #[cfg(not(debug_assertions))]
// fn watch_file_types(_fs: Arc<dyn Fs>, _cx: &mut AppContext) {}
#[cfg(not(debug_assertions))]
fn watch_file_types(_fs: Arc<dyn Fs>, _cx: &mut AppContext) {}