I am trying to turnnamespace DevComponents.WpfEditors.Primitives{    /// <summary>    /// Interaction logic for EditorFreeTextButton.xaml    /// </summary>    public partial class EditorFreeTextButton : EditorButton    {        public EditorFreeTextButton()        {            InitializeComponent();        }    }}intonamespace DevComponents.WpfEditors.Primitives{    /// <summary>    /// Interaction logic for EditorFreeTextButton.xaml    /// </summary>    [System.Reflection.Obfuscation(Exclude = true)]    public partial class EditorFreeTextButton : EditorButton    {        public EditorFreeTextButton()        {            InitializeComponent();        }    }}through Roslyn. I have the following code that works private static SyntaxNode AddAnnotation(ClassDeclarationSyntax classNode, SyntaxNode rootNode){    var name = SyntaxFactory.ParseName(System.Reflection.Obfuscation);    var arguments = SyntaxFactory.ParseAttributeArgumentList((Exclude = true));    var attribute = SyntaxFactory.Attribute(name, arguments);    var leadingTrivia = classNode.GetLeadingTrivia();    var whitespace = leadingTrivia.LastOrDefault(x => x.Kind() == SyntaxKind.WhitespaceTrivia);    var attributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(attribute))        .WithTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed);    var newClassNode = classNode.WithoutLeadingTrivia()        .WithLeadingTrivia(whitespace)        .AddAttributeLists(attributeList)        .WithLeadingTrivia(leadingTrivia);    rootNode = rootNode.ReplaceNode(classNode, newClassNode);    return rootNode;}However I feel like I am coding in circles to get all the leading Trivia right. Is there a easier way to insert an attribute to be after the SingleLineDocumentationCommentTrivia and be formatted correctly with the correct leading whitespace trivia?
Adding an attribute to a class after the documentation comment trivia
c#;roslyn