using Microsoft.CodeAnalysis.QuickInfo;
using System.Text;

namespace RobotNet.WebApp.Scripts.Monaco;

public static class StringBuilderExtension
{
    public static void AppendSection(this StringBuilder builder, QuickInfoSection section, MarkdownFormat format, ref bool lastLineBreak)
    {
        if (!lastLineBreak && section.TaggedParts.Length > 0 && section.TaggedParts[0].Tag != "LineBreak")
        {
            builder.Append("\n\n");
        }
        MarkdownHelpers.TaggedTextToMarkdown(section.TaggedParts, builder, "\n", format, out lastLineBreak);
    }
}
