diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index c6a850feb8..a3aa65e53f 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -319,6 +319,7 @@ pub struct LanguageRegistry { >, >, subscription: RwLock<(watch::Sender<()>, watch::Receiver<()>)>, + theme: RwLock>>, } impl LanguageRegistry { @@ -332,6 +333,7 @@ impl LanguageRegistry { login_shell_env_loaded: login_shell_env_loaded.shared(), lsp_binary_paths: Default::default(), subscription: RwLock::new(watch::channel()), + theme: Default::default(), } } @@ -341,6 +343,9 @@ impl LanguageRegistry { } pub fn add(&self, language: Arc) { + if let Some(theme) = self.theme.read().clone() { + language.set_theme(theme); + } self.languages.write().push(language.clone()); *self.subscription.write().0.borrow_mut() = (); } @@ -350,6 +355,7 @@ impl LanguageRegistry { } pub fn set_theme(&self, theme: Arc) { + *self.theme.write() = Some(theme.clone()); for language in self.languages.read().iter() { language.set_theme(theme.clone()); } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 4961504448..58d16e215b 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -225,8 +225,8 @@ fn main() { cx.spawn({ let languages = languages.clone(); |cx| async move { - init_languages.await; - dbg!("all languages initialized, starting setting highlighting"); + // init_languages.await; + dbg!("not all languages initialized, but starting setting highlighting"); cx.read(|cx| { languages.set_theme(cx.global::().theme.editor.syntax.clone()) }); diff --git a/test.rs b/test.rs deleted file mode 100644 index 0df70d1f2d..0000000000 --- a/test.rs +++ /dev/null @@ -1 +0,0 @@ -const A: usize = 32;