public override void Append()

in src/Epam.GraphQL/Diagnostics/Internals/ChainConfigurationContext.cs [153:225]


        public override void Append(StringBuilder builder, IEnumerable<IConfigurationContext> choosenItems, int indent)
        {
            if (Previous == null)
            {
                builder.Append(' ', indent * 4);
            }
            else
            {
                Previous.Append(builder, choosenItems, indent);

                if (choosenItems.Contains(Previous))
                {
                    builder.Append(" // <-----");
                }

                builder.AppendLine();
                builder.Append(' ', (indent + 1) * 4);
                builder.Append('.');
            }

            builder.Append(Operation);
            var arguments = Children.OfType<ChainArgumentConfigurationContext>().ToList();
            var lastIndex = arguments.Count - 1;

            while (lastIndex >= 0 && arguments[lastIndex].IsDefault)
            {
                lastIndex -= 1;
            }

            builder.Append('(');

            for (var i = 0; i <= lastIndex; i++)
            {
                if (lastIndex == 0)
                {
                    arguments[i].Append(builder, choosenItems, 0);
                }
                else
                {
                    builder.AppendLine();
                    var newIndent = indent + 1;

                    if (Previous != null)
                    {
                        newIndent += 1;
                    }

                    arguments[i].Append(builder, choosenItems, newIndent);
                }

                if (i < lastIndex)
                {
                    builder.Append(',');

                    if (choosenItems.Contains(arguments[i]))
                    {
                        builder.Append(" // <-----");
                    }
                }
            }

            builder.Append(')');

            if (Next == null)
            {
                builder.Append(';');
            }

            if (lastIndex >= 0 && choosenItems.Contains(arguments[lastIndex]))
            {
                builder.Append(" // <-----");
            }
        }