|
|
|
@ -2793,10 +2793,22 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
@@ -2793,10 +2793,22 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
|
|
|
|
|
|
|
|
|
|
public override object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression arrayInitializerExpression, object data) |
|
|
|
|
{ |
|
|
|
|
outputFormatter.PrintToken(Tokens.OpenCurlyBrace); |
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
this.AppendCommaSeparatedList(arrayInitializerExpression.CreateExpressions); |
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
outputFormatter.PrintToken (Tokens.OpenCurlyBrace); |
|
|
|
|
if (arrayInitializerExpression.CreateExpressions.Count == 1) { |
|
|
|
|
outputFormatter.Space (); |
|
|
|
|
} else { |
|
|
|
|
outputFormatter.IndentationLevel++; |
|
|
|
|
outputFormatter.NewLine (); |
|
|
|
|
outputFormatter.Indent (); |
|
|
|
|
} |
|
|
|
|
this.AppendCommaSeparatedList (arrayInitializerExpression.CreateExpressions, true); |
|
|
|
|
if (arrayInitializerExpression.CreateExpressions.Count == 1) { |
|
|
|
|
outputFormatter.Space (); |
|
|
|
|
} else { |
|
|
|
|
outputFormatter.IndentationLevel--; |
|
|
|
|
outputFormatter.NewLine(); |
|
|
|
|
outputFormatter.Indent(); |
|
|
|
|
} |
|
|
|
|
outputFormatter.PrintToken(Tokens.CloseCurlyBrace); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
@ -2916,6 +2928,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
@@ -2916,6 +2928,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AppendCommaSeparatedList<T>(ICollection<T> list) where T : class, INode |
|
|
|
|
{ |
|
|
|
|
AppendCommaSeparatedList(list, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void AppendCommaSeparatedList<T>(ICollection<T> list, bool alwaysBreakLine) where T : class, INode |
|
|
|
|
{ |
|
|
|
|
if (list != null) { |
|
|
|
|
int i = 0; |
|
|
|
@ -2923,10 +2940,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
@@ -2923,10 +2940,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
|
|
|
|
|
node.AcceptVisitor(this, null); |
|
|
|
|
if (i + 1 < list.Count) { |
|
|
|
|
PrintFormattedComma(); |
|
|
|
|
} |
|
|
|
|
if ((i + 1) % 10 == 0) { |
|
|
|
|
outputFormatter.NewLine(); |
|
|
|
|
outputFormatter.Indent(); |
|
|
|
|
if (alwaysBreakLine || (i + 1) % 10 == 0) { |
|
|
|
|
outputFormatter.NewLine(); |
|
|
|
|
outputFormatter.Indent(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|