public static async Task <Document> RefactorAsync(
            Document document,
            MemberDeclarationSyntax memberDeclaration,
            bool copyCommentFromBaseIfAvailable,
            CancellationToken cancellationToken)
        {
            MemberDeclarationSyntax newNode = null;

            if (copyCommentFromBaseIfAvailable &&
                DocumentationCommentGenerator.CanGenerateFromBase(memberDeclaration.Kind()))
            {
                SemanticModel semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);

                BaseDocumentationCommentInfo info = DocumentationCommentGenerator.GenerateFromBase(memberDeclaration, semanticModel, cancellationToken);

                if (info.Success)
                {
                    newNode = Inserter.InsertDocumentationComment(memberDeclaration, info.Trivia, indent: true);
                }
            }

            newNode = newNode ?? DocumentationCommentGenerator.AddNewDocumentationComment(memberDeclaration);

            return(await document.ReplaceNodeAsync(memberDeclaration, newNode, cancellationToken).ConfigureAwait(false));
        }
        public static async Task ComputeRefactoringAsync(RefactoringContext context, ConstructorDeclarationSyntax constructorDeclaration)
        {
            if (!constructorDeclaration.HasSingleLineDocumentationComment())
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                BaseDocumentationCommentInfo info = DocumentationCommentGenerator.GenerateFromBase(constructorDeclaration, semanticModel, context.CancellationToken);

                if (info.Success)
                {
                    RegisterRefactoring(context, constructorDeclaration, info);
                }
            }
        }
 private static void RegisterRefactoring(RefactoringContext context, MemberDeclarationSyntax memberDeclaration, BaseDocumentationCommentInfo info)
 {
     context.RegisterRefactoring(
         GetTitle(memberDeclaration, info.Origin),
         cancellationToken => RefactorAsync(context.Document, memberDeclaration, info.Trivia, cancellationToken));
 }