diff --git a/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs b/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs index 123c2f0af0..37a0e37a9f 100644 --- a/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs +++ b/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs @@ -186,6 +186,31 @@ fn test_fn() { let one = 1; let s = TestStruct{ ..a }; } +"#, + ); + } + + #[test] + fn test_fill_struct_fields_blank_line() { + check_fix( + r#" +struct S { a: (), b: () } + +fn f() { + S { + $0 + }; +} +"#, + r#" +struct S { a: (), b: () } + +fn f() { + S { + a: (), + b: (), + }; +} "#, ); } diff --git a/crates/syntax/src/ast/edit_in_place.rs b/crates/syntax/src/ast/edit_in_place.rs index 14624c6825..2676ed8c98 100644 --- a/crates/syntax/src/ast/edit_in_place.rs +++ b/crates/syntax/src/ast/edit_in_place.rs @@ -378,6 +378,10 @@ impl ast::RecordExprFieldList { make::tokens::single_space() }; + if is_multiline { + normalize_ws_between_braces(self.syntax()); + } + let position = match self.fields().last() { Some(last_field) => { let comma = match last_field