/// <summary> /// Adds documentation header async. /// </summary> /// <param name="document">The document.</param> /// <param name="root">The root.</param> /// <param name="declarationSyntax">The declaration syntax.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>A Document.</returns> private async Task <Document> AddDocumentationHeaderAsync(Document document, SyntaxNode root, EnumDeclarationSyntax declarationSyntax, CancellationToken cancellationToken) { SyntaxTriviaList leadingTrivia = declarationSyntax.GetLeadingTrivia(); string comment = CommentHelper.CreateEnumComment(declarationSyntax.Identifier.ValueText); DocumentationCommentTriviaSyntax commentTrivia = await Task.Run(() => DocumentationHeaderHelper.CreateOnlySummaryDocumentationCommentTrivia(comment), cancellationToken); SyntaxTriviaList newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia)); EnumDeclarationSyntax newDeclaration = declarationSyntax.WithLeadingTrivia(newLeadingTrivia); SyntaxNode newRoot = root.ReplaceNode(declarationSyntax, newDeclaration); return(document.WithSyntaxRoot(newRoot)); }