File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 5
5
### Formatter
6
6
7
7
- Fixed a bug where the ` @internal ` annotation wouldn't be displayed.
8
+ - Fixed a bug where a record update's arguments would be incorrectly split on
9
+ multiple lines.
8
10
9
11
## v1.1.0-rc2 - 2024-04-10
10
12
Original file line number Diff line number Diff line change @@ -1149,7 +1149,7 @@ impl<'comments> Formatter<'comments> {
1149
1149
let constructor_doc = self . expr ( constructor) ;
1150
1150
let comments = self . pop_comments ( spread. base . location ( ) . start ) ;
1151
1151
let spread_doc = commented ( ".." . to_doc ( ) . append ( self . expr ( & spread. base ) ) , comments) ;
1152
- let arg_docs = args. iter ( ) . map ( |a| self . record_update_arg ( a) ) ;
1152
+ let arg_docs = args. iter ( ) . map ( |a| self . record_update_arg ( a) . group ( ) ) ;
1153
1153
let all_arg_docs = once ( spread_doc) . chain ( arg_docs) ;
1154
1154
constructor_doc. append ( wrap_args ( all_arg_docs) ) . group ( )
1155
1155
}
Original file line number Diff line number Diff line change @@ -5840,6 +5840,21 @@ fn piped_blocks_are_not_needlessly_indented() {
5840
5840
) ;
5841
5841
}
5842
5842
5843
+ // https://github.com/gleam-lang/gleam/issues/2924
5844
+ #[ test]
5845
+ fn record_update_fields_are_not_needlessly_broken ( ) {
5846
+ assert_format ! (
5847
+ r#"pub fn main() {
5848
+ Model(
5849
+ ..model,
5850
+ wibble: wibble_wobble_wibble_wobble + 1,
5851
+ wobble: Some(wibble_wobble_wibble_wobble),
5852
+ )
5853
+ }
5854
+ "#
5855
+ ) ;
5856
+ }
5857
+
5843
5858
// https://github.com/gleam-lang/gleam/issues/2890
5844
5859
#[ test]
5845
5860
fn piped_lists_are_not_needlessly_indented ( ) {
You can’t perform that action at this time.
0 commit comments