Merge remote-tracking branch 'origin/main' into editor-movement

Antonio Scandurra created

Change summary

crates/theme2/src/registry.rs            |  7 ++++-
crates/theme2/src/themes/andromeda.rs    |  3 ++
crates/theme2/src/themes/ayu.rs          |  3 ++
crates/theme2/src/themes/dracula.rs      |  3 ++
crates/theme2/src/themes/gruvbox.rs      |  3 ++
crates/theme2/src/themes/mod.rs          |  5 +++
crates/theme2/src/themes/night_owl.rs    |  3 ++
crates/theme2/src/themes/nord.rs         |  3 ++
crates/theme2/src/themes/notctis.rs      |  3 ++
crates/theme2/src/themes/palenight.rs    |  3 ++
crates/theme2/src/themes/rose_pine.rs    |  3 ++
crates/theme2/src/themes/solarized.rs    |  3 ++
crates/theme2/src/themes/synthwave_84.rs |  3 ++
crates/theme_importer/src/main.rs        | 27 +++++++++++++++++++++++++
14 files changed, 68 insertions(+), 4 deletions(-)

Detailed changes

crates/theme2/src/registry.rs 🔗

@@ -52,7 +52,10 @@ impl ThemeRegistry {
                     status: StatusColors::default(),
                     git: GitStatusColors::default(),
                     player: PlayerColors::default(),
-                    syntax: Arc::new(SyntaxTheme::default_dark()),
+                    syntax: match user_theme.appearance {
+                        Appearance::Light => Arc::new(SyntaxTheme::default_light()),
+                        Appearance::Dark => Arc::new(SyntaxTheme::default_dark()),
+                    },
                 },
             }
         }));
@@ -81,7 +84,7 @@ impl Default for ThemeRegistry {
         };
 
         this.insert_theme_families([zed_pro_family()]);
-        this.insert_user_theme_familes(crate::all_imported_themes());
+        this.insert_user_theme_familes(crate::all_user_themes());
 
         this
     }

crates/theme2/src/themes/ayu.rs 🔗

@@ -1,3 +1,6 @@
+// This file was generated by the `theme_importer`.
+// Be careful when modifying it by hand.
+
 use gpui::rgba;
 
 use crate::{

crates/theme2/src/themes/mod.rs 🔗

@@ -1,3 +1,6 @@
+// This file was generated by the `theme_importer`.
+// Be careful when modifying it by hand.
+
 mod andromeda;
 mod ayu;
 mod dracula;
@@ -24,7 +27,7 @@ pub use synthwave_84::*;
 
 use crate::UserThemeFamily;
 
-pub(crate) fn all_imported_themes() -> Vec<UserThemeFamily> {
+pub(crate) fn all_user_themes() -> Vec<UserThemeFamily> {
     vec![
         rose_pine(),
         night_owl(),

crates/theme2/src/themes/nord.rs 🔗

@@ -1,3 +1,6 @@
+// This file was generated by the `theme_importer`.
+// Be careful when modifying it by hand.
+
 use gpui::rgba;
 
 use crate::{

crates/theme_importer/src/main.rs 🔗

@@ -5,6 +5,7 @@ mod vscode;
 use std::fs::{self, File};
 use std::io::Write;
 use std::path::PathBuf;
+use std::process::Command;
 use std::str::FromStr;
 
 use anyhow::{anyhow, Context, Result};
@@ -152,6 +153,9 @@ fn main() -> Result<()> {
 
         let theme_module = format!(
             r#"
+            // This file was generated by the `theme_importer`.
+            // Be careful when modifying it by hand.
+
             use gpui::rgba;
 
             use crate::{{
@@ -174,7 +178,7 @@ fn main() -> Result<()> {
         r#"
         use crate::UserThemeFamily;
 
-        pub(crate) fn all_imported_themes() -> Vec<UserThemeFamily> {{
+        pub(crate) fn all_user_themes() -> Vec<UserThemeFamily> {{
             vec![{all_themes}]
         }}
         "#,
@@ -187,6 +191,9 @@ fn main() -> Result<()> {
 
     let mod_rs_contents = format!(
         r#"
+        // This file was generated by the `theme_importer`.
+        // Be careful when modifying it by hand.
+
         {mod_statements}
 
         {use_statements}
@@ -208,5 +215,23 @@ fn main() -> Result<()> {
 
     mod_rs_file.write_all(mod_rs_contents.as_bytes())?;
 
+    println!("Formatting themes...");
+
+    let format_result = format_themes_crate()
+        // We need to format a second time to catch all of the formatting issues.
+        .and_then(|_| format_themes_crate());
+
+    if let Err(err) = format_result {
+        eprintln!("Failed to format themes: {}", err);
+    }
+
+    println!("Done!");
+
     Ok(())
 }
+
+fn format_themes_crate() -> std::io::Result<std::process::Output> {
+    Command::new("cargo")
+        .args(["fmt", "--package", "theme2"])
+        .output()
+}