@@ -12,10 +12,10 @@ public static Doc Print(RawNode node, PrintingContext context)
1212 var groupIds = new List < string > ( ) ;
1313 foreach ( var _ in node . Nodes )
1414 {
15- groupIds . Add ( context . GroupFor ( "symbol " ) ) ;
15+ groupIds . Add ( context . GroupFor ( "children group " ) ) ;
1616 }
1717
18- var result = new DocListBuilder ( node . Nodes . Count * 5 ) ;
18+ var result = new List < Doc > ( ) ;
1919 var x = 0 ;
2020 foreach ( var childNode in node . Nodes )
2121 {
@@ -25,10 +25,10 @@ public static Doc Print(RawNode node, PrintingContext context)
2525 continue ;
2626 }
2727
28- var prevParts = new DocListBuilder ( 2 ) ;
29- var leadingParts = new DocListBuilder ( 2 ) ;
30- var trailingParts = new DocListBuilder ( 2 ) ;
31- var nextParts = new DocListBuilder ( 2 ) ;
28+ var prevParts = new List < Doc > ( ) ;
29+ var leadingParts = new List < Doc > ( ) ;
30+ var trailingParts = new List < Doc > ( ) ;
31+ var nextParts = new List < Doc > ( ) ;
3232
3333 var prevBetweenLine = childNode . PreviousNode is not null
3434 ? PrintBetweenLine ( childNode . PreviousNode , childNode )
@@ -38,17 +38,6 @@ public static Doc Print(RawNode node, PrintingContext context)
3838 ? PrintBetweenLine ( childNode , childNode . NextNode )
3939 : Doc . Null ;
4040
41- if (
42- context . Options . XmlWhitespaceSensitivity is not XmlWhitespaceSensitivity . Strict
43- && childNode . PreviousNode is null
44- && childNode . NextNode is null
45- && childNode . IsTextLike ( )
46- )
47- {
48- prevBetweenLine = Doc . SoftLine ;
49- nextBetweenLine = Doc . SoftLine ;
50- }
51-
5241 if ( prevBetweenLine is not NullDoc )
5342 {
5443 if ( prevBetweenLine is HardLine )
@@ -87,22 +76,22 @@ context.Options.XmlWhitespaceSensitivity is not XmlWhitespaceSensitivity.Strict
8776 }
8877 }
8978
90- result . Add ( prevParts . AsSpan ( ) ) ;
79+ result . AddRange ( prevParts ) ;
9180 result . Add (
9281 Doc . Group (
93- Doc . Concat ( ref leadingParts ) ,
82+ Doc . Concat ( leadingParts ) ,
9483 Doc . GroupWithId (
9584 groupIds [ x ] ,
9685 PrintChild ( childNode , context ) ,
97- Doc . Concat ( ref trailingParts )
86+ Doc . Concat ( trailingParts )
9887 )
9988 )
10089 ) ;
101- result . Add ( nextParts . AsSpan ( ) ) ;
90+ result . AddRange ( nextParts ) ;
10291 x ++ ;
10392 }
10493
105- return Doc . Concat ( ref result ) ;
94+ return Doc . Concat ( result ) ;
10695 }
10796
10897 public static Doc PrintChild ( RawNode child , PrintingContext context )
0 commit comments