Allow empty values in .editorconfig (#60026)

Closes https://github.com/zed-industries/zed/pull/59559
Closes https://github.com/zed-industries/zed/issues/59466

Release Notes:

- Fixed incorrect parsing of .editorconfig with empty values
This commit is contained in:
Kirill Bulatov authored and GitHub committed 2026-06-28 16:15:20 +00:00
1 parent fe2c2f4000
commit 314cfdccfb
2 files changed
+18 -1

No files matched your search

+1 -1
View File
@@ -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"
@@ -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/settings
assert_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 root
assert_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 used
assert_eq!(Some(settings_c.tab_size), NonZeroU32::new(10));