@@ -719,16 +719,7 @@ const Formatter = struct {
719719 }
720720 _ = try formatter (fmt , item_idx );
721721 if (multiline ) {
722- // special case for multiline_strings
723- var node = fmt .ast .store .nodes .get (@enumFromInt (@intFromEnum (item_idx )));
724- if (node .tag == .record_field ) {
725- const field = fmt .ast .store .getRecordField (@enumFromInt (@intFromEnum (item_idx )));
726- if (field .value ) | v | {
727- node = fmt .ast .store .nodes .get (@enumFromInt (@intFromEnum (v )));
728- }
729- }
730- if (node .tag == .multiline_string ) {
731- try fmt .ensureNewline ();
722+ if (fmt .has_newline ) {
732723 try fmt .pushIndent ();
733724 }
734725 try fmt .push (',' );
@@ -853,6 +844,7 @@ const Formatter = struct {
853844 },
854845 }
855846 }
847+ try fmt .ensureNewline ();
856848 },
857849 .single_quote = > | s | {
858850 try fmt .pushTokenText (s .token );
@@ -946,14 +938,8 @@ const Formatter = struct {
946938 }
947939 const field_region = try fmt .formatRecordField (field_idx );
948940 if (multiline ) {
949- const field = fmt .ast .store .getRecordField (field_idx );
950- if (field .value ) | v | {
951- const node = fmt .ast .store .nodes .get (@enumFromInt (@intFromEnum (v )));
952- // special case for multiline_strings
953- if (node .tag == .multiline_string ) {
954- try fmt .ensureNewline ();
955- try fmt .pushIndent ();
956- }
941+ if (fmt .has_newline ) {
942+ try fmt .pushIndent ();
957943 }
958944 try fmt .push (',' );
959945 _ = try fmt .flushCommentsAfter (field_region .end );
@@ -1931,7 +1917,7 @@ const Formatter = struct {
19311917
19321918 fn flushComments (fmt : * Formatter , between_text : []const u8 ) ! bool {
19331919 var found_comment = false ;
1934- var newline_count : usize = 0 ;
1920+ var newline_count : usize = if ( fmt . has_newline ) 1 else 0 ;
19351921 var i : usize = 0 ;
19361922 while (i < between_text .len ) {
19371923 if (between_text [i ] == '#' ) {
0 commit comments