@@ -1154,6 +1154,7 @@ fn parse_named_import_or_export_specifiers<'a>(parent: &Node<'a>, specifiers: Ve
1154
1154
prefer_hanging : get_prefer_hanging ( parent, context) ,
1155
1155
prefer_single_line : get_prefer_single_line ( parent, context) ,
1156
1156
surround_single_line_with_spaces : get_use_space ( parent, context) ,
1157
+ allow_blank_lines : false ,
1157
1158
node_sorter : get_node_sorter ( parent, context) ,
1158
1159
} , context) ;
1159
1160
@@ -1971,6 +1972,7 @@ fn parse_object_lit<'a>(node: &'a ObjectLit, context: &mut Context<'a>) -> Print
1971
1972
prefer_hanging : context. config . object_expression_prefer_hanging ,
1972
1973
prefer_single_line : context. config . object_expression_prefer_single_line ,
1973
1974
surround_single_line_with_spaces : true ,
1975
+ allow_blank_lines : true ,
1974
1976
node_sorter : None ,
1975
1977
} , context)
1976
1978
}
@@ -2443,6 +2445,7 @@ fn parse_type_lit<'a>(node: &'a TsTypeLit, context: &mut Context<'a>) -> PrintIt
2443
2445
prefer_hanging : context. config . type_literal_prefer_hanging ,
2444
2446
prefer_single_line : context. config . type_literal_prefer_single_line ,
2445
2447
surround_single_line_with_spaces : true ,
2448
+ allow_blank_lines : true ,
2446
2449
node_sorter : None ,
2447
2450
} , context) ;
2448
2451
@@ -2828,6 +2831,7 @@ fn parse_object_pat<'a>(node: &'a ObjectPat, context: &mut Context<'a>) -> Print
2828
2831
prefer_hanging : context. config . object_pattern_prefer_hanging ,
2829
2832
prefer_single_line : context. config . object_pattern_prefer_single_line ,
2830
2833
surround_single_line_with_spaces : true ,
2834
+ allow_blank_lines : true ,
2831
2835
node_sorter : None ,
2832
2836
} , context) ) ;
2833
2837
if node. optional { items. push_str ( "?" ) ; }
@@ -5111,6 +5115,13 @@ fn parse_separated_values_with_result<'a>(
5111
5115
let indent_width = context. config . indent_width ;
5112
5116
let compute_lines_span = opts. allow_blank_lines ; // save time otherwise
5113
5117
let node_sorter = opts. node_sorter ;
5118
+
5119
+ // would need to make this take into account the new position of the nodes
5120
+ #[ cfg( debug_assertions) ]
5121
+ if node_sorter. is_some ( ) && compute_lines_span {
5122
+ panic ! ( "Not implemented scenario. Cannot computed lines span and allow blank lines" ) ;
5123
+ }
5124
+
5114
5125
parser_helpers:: parse_separated_values ( |is_multi_line_or_hanging_ref| {
5115
5126
let is_multi_line_or_hanging = is_multi_line_or_hanging_ref. create_resolver ( ) ;
5116
5127
let mut parsed_nodes = Vec :: new ( ) ;
@@ -5423,6 +5434,7 @@ struct ParseObjectLikeNodeOptions<'a> {
5423
5434
prefer_hanging : bool ,
5424
5435
prefer_single_line : bool ,
5425
5436
surround_single_line_with_spaces : bool ,
5437
+ allow_blank_lines : bool ,
5426
5438
node_sorter : Option < Box < dyn Fn ( & Option < Node < ' a > > , & Option < Node < ' a > > , & mut Context < ' a > ) -> std:: cmp:: Ordering > > ,
5427
5439
}
5428
5440
@@ -5448,7 +5460,7 @@ fn parse_object_like_node<'a>(opts: ParseObjectLikeNodeOptions<'a>, context: &mu
5448
5460
nodes : opts. members . into_iter ( ) . map ( |x| Some ( x) ) . collect ( ) ,
5449
5461
prefer_hanging : opts. prefer_hanging ,
5450
5462
force_use_new_lines : force_multi_line,
5451
- allow_blank_lines : true ,
5463
+ allow_blank_lines : opts . allow_blank_lines ,
5452
5464
separator : opts. separator ,
5453
5465
single_line_space_at_start : opts. surround_single_line_with_spaces ,
5454
5466
single_line_space_at_end : opts. surround_single_line_with_spaces ,
0 commit comments