示例#1
0
            public override SyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node)
            {
                var newlined = new List <ExpressionSyntax>();

                var leading = TriviaList(CarriageReturnLineFeed)
                              .AddRange(node.GetLeadingTrivia())
                              .Add(SyntaxFactory.Space)
                              .Add(SyntaxFactory.Space)
                              .Add(SyntaxFactory.Space)
                              .Add(SyntaxFactory.Space);

                ExpressionSyntax last = null;

                foreach (var exp in node.Expressions)
                {
                    last = exp.WithLeadingTrivia(leading);
                    newlined.Add(last);
                }

                if (last != null)
                {
                    newlined[^ 1] = last.WithTrailingTrivia(TriviaList(CarriageReturnLineFeed)