diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 73350bcda7..d1f927dfd0 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -184,8 +184,6 @@ fn main() { load_user_themes_in_background(fs.clone(), cx); watch_themes(fs.clone(), cx); - cx.spawn(|_| watch_languages(fs.clone(), languages.clone())) - .detach(); watch_file_types(fs.clone(), cx); languages.set_theme(cx.theme().clone()); @@ -1004,32 +1002,20 @@ fn watch_themes(fs: Arc, cx: &mut AppContext) { .detach() } -#[cfg(debug_assertions)] -async fn watch_languages(fs: Arc, languages: Arc) { - use std::time::Duration; - - let reload_debounce = Duration::from_millis(250); - - let mut events = fs - .watch("crates/zed/src/languages".as_ref(), reload_debounce) - .await; - - while (events.next().await).is_some() { - languages.reload(); - } -} - #[cfg(debug_assertions)] fn watch_file_types(fs: Arc, cx: &mut AppContext) { use std::time::Duration; + let path = { + let p = Path::new("assets/icons/file_icons/file_types.json"); + let Ok(full_path) = p.canonicalize() else { + return; + }; + full_path + }; + cx.spawn(|cx| async move { - let mut events = fs - .watch( - "assets/icons/file_icons/file_types.json".as_ref(), - Duration::from_millis(100), - ) - .await; + let mut events = fs.watch(path.as_path(), Duration::from_millis(100)).await; while (events.next().await).is_some() { cx.update(|cx| { cx.update_global(|file_types, _| { @@ -1044,6 +1030,3 @@ fn watch_file_types(fs: Arc, cx: &mut AppContext) { #[cfg(not(debug_assertions))] fn watch_file_types(_fs: Arc, _cx: &mut AppContext) {} - -#[cfg(not(debug_assertions))] -async fn watch_languages(_fs: Arc, _languages: Arc) {}