/// <summary> /// add documentation for the constructor. /// </summary> /// <param name="context">the code fix context.</param> /// <param name="root">the syntax root.</param> /// <param name="constructorDeclaration">the constructor declaration syntax.</param> /// <param name="documentComment">the document content.</param> /// <returns>the resulting document.</returns> private Task<Document> AddDocumentationAsync(CodeFixContext context, SyntaxNode root, ConstructorDeclarationSyntax constructorDeclaration, DocumentationCommentTriviaSyntax documentComment) { var lines = documentComment.GetExistingSummaryCommentDocumentation() ?? new string[] { }; var standardCommentText = this._commentNodeFactory.PrependStandardCommentText(constructorDeclaration, lines); var parameters = this._commentNodeFactory.CreateParameters(constructorDeclaration, documentComment); var summaryPlusParameters = new XmlNodeSyntax[] { standardCommentText } .Concat(parameters) .ToArray(); var comment = this._commentNodeFactory .CreateDocumentComment(summaryPlusParameters) .AddLeadingEndOfLineTriviaFrom(constructorDeclaration.GetLeadingTrivia()); var trivia = SyntaxFactory.Trivia(comment); var result = documentComment != null ? root.ReplaceNode(documentComment, comment.AdjustDocumentationCommentNewLineTrivia()) : root.ReplaceNode(constructorDeclaration, constructorDeclaration.WithLeadingTrivia(trivia)); var newDocument = context.Document.WithSyntaxRoot(result); return Task.FromResult(newDocument); }