Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Allow empty values in .editorconfig (#60026)
Kirill Bulatov7582bf74349f
diff --git a/Cargo.toml b/Cargo.tomlindex 19145a6727d..4f36916d2dd 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -585,7 +585,7 @@ dirs = "6.0"documented = "0.9.1"dotenvy = "0.15.0"dunce = "1.0"-ec4rs = "1.1"+ec4rs = { version = "1.2", features = ["allow-empty-values"] }emojis = "0.6.1"env_logger = "0.11"encoding_rs = "0.8"diff --git a/crates/project/tests/integration/project_tests.rs b/crates/project/tests/integration/project_tests.rsindex bed11fa216e..037e62c6e0c 100644--- a/crates/project/tests/integration/project_tests.rs+++ b/crates/project/tests/integration/project_tests.rs@@ -284,6 +284,15 @@ async fn test_editorconfig_support(cx: &mut gpui::TestAppContext) {"#,"d.rs": "fn d() {\n D\n}",},+ "e": {+ ".editorconfig": r#"+ [*.rs]+ indent_size = 5+ indent_style = space+ max_line_length =+ "#,+ "e.rs": "fn e() {\n E\n}",+ },"README.json": "tabs are better\n",}));@@ -315,6 +324,7 @@ async fn test_editorconfig_support(cx: &mut gpui::TestAppContext) {let settings_b = settings_for("b/b.rs", cx).await;let settings_c = settings_for("c.js", cx).await;let settings_d = settings_for("d/d.rs", cx).await;+ let settings_e = settings_for("e/e.rs", cx).await;let settings_readme = settings_for("README.json", cx).await;// .editorconfig overrides .zed/settingsassert_eq!(Some(settings_a.tab_size), NonZeroU32::new(3));@@ -330,6 +340,13 @@ async fn test_editorconfig_support(cx: &mut gpui::TestAppContext) {// .editorconfig in subdirectory overrides .editorconfig in rootassert_eq!(Some(settings_d.tab_size), NonZeroU32::new(1));+ // Non-empty values in e/ are parsed and applied as usual.+ assert_eq!(Some(settings_e.tab_size), NonZeroU32::new(5));+ assert_eq!(settings_e.hard_tabs, false);+ // An empty value opts out of the inherited `max_line_length = 120`,+ // falling back to .zed/settings.json instead of rejecting the whole file.+ assert_eq!(settings_e.preferred_line_length, 64);+// "indent_size" is not set, so "tab_width" is usedassert_eq!(Some(settings_c.tab_size), NonZeroU32::new(10));