Example #1
0
        public static ArgumentListSyntax ToMultiLine(ArgumentListSyntax argumentList, CancellationToken cancellationToken = default(CancellationToken))
        {
            SyntaxTriviaList leadingTrivia = argumentList.GetIncreasedIndentation(cancellationToken);

            var nodesAndTokens = new List <SyntaxNodeOrToken>();

            SeparatedSyntaxList <ArgumentSyntax> .Enumerator en = argumentList.Arguments.GetEnumerator();

            if (en.MoveNext())
            {
                nodesAndTokens.Add(en.Current
                                   .TrimTrailingTrivia()
                                   .WithLeadingTrivia(leadingTrivia));

                while (en.MoveNext())
                {
                    nodesAndTokens.Add(CommaToken().WithTrailingTrivia(NewLine()));

                    nodesAndTokens.Add(en.Current
                                       .TrimTrailingTrivia()
                                       .WithLeadingTrivia(leadingTrivia));
                }
            }

            return(ArgumentList(
                       OpenParenToken().WithTrailingTrivia(NewLine()),
                       SeparatedList <ArgumentSyntax>(nodesAndTokens),
                       argumentList.CloseParenToken.WithoutLeadingTrivia()));
        }