diff options
-rw-r--r-- | crates/ide/src/diagnostics/fixes/fill_missing_fields.rs | 25 | ||||
-rw-r--r-- | crates/syntax/src/ast/edit_in_place.rs | 4 |
2 files changed, 29 insertions, 0 deletions
diff --git a/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs b/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs index 123c2f0af..37a0e37a9 100644 --- a/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs +++ b/crates/ide/src/diagnostics/fixes/fill_missing_fields.rs | |||
@@ -189,4 +189,29 @@ fn test_fn() { | |||
189 | "#, | 189 | "#, |
190 | ); | 190 | ); |
191 | } | 191 | } |
192 | |||
193 | #[test] | ||
194 | fn test_fill_struct_fields_blank_line() { | ||
195 | check_fix( | ||
196 | r#" | ||
197 | struct S { a: (), b: () } | ||
198 | |||
199 | fn f() { | ||
200 | S { | ||
201 | $0 | ||
202 | }; | ||
203 | } | ||
204 | "#, | ||
205 | r#" | ||
206 | struct S { a: (), b: () } | ||
207 | |||
208 | fn f() { | ||
209 | S { | ||
210 | a: (), | ||
211 | b: (), | ||
212 | }; | ||
213 | } | ||
214 | "#, | ||
215 | ); | ||
216 | } | ||
192 | } | 217 | } |
diff --git a/crates/syntax/src/ast/edit_in_place.rs b/crates/syntax/src/ast/edit_in_place.rs index 14624c682..2676ed8c9 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 { | |||
378 | make::tokens::single_space() | 378 | make::tokens::single_space() |
379 | }; | 379 | }; |
380 | 380 | ||
381 | if is_multiline { | ||
382 | normalize_ws_between_braces(self.syntax()); | ||
383 | } | ||
384 | |||
381 | let position = match self.fields().last() { | 385 | let position = match self.fields().last() { |
382 | Some(last_field) => { | 386 | Some(last_field) => { |
383 | let comma = match last_field | 387 | let comma = match last_field |