private Task <Document> AddSummaryCommentAsync(Document document, BaseTypeDeclarationSyntax declaration, CancellationToken c)
        {
            var leadingTrivias  = declaration.GetLeadingTrivia();
            var whitespaceCount = leadingTrivias[leadingTrivias.Count - 1].Span.Length;
            var newDeclaration  = declaration.WithLeadingTrivia(
                AnalyzerUtil.GetNewLeadingTriviaWithSummary(leadingTrivias, summaryComments, whitespaceCount));

            return(AnalyzerUtil.ReplaceNode(declaration, newDeclaration, document));
        }
Ejemplo n.º 2
0
        private Task <Document> AddFileDoxygenCommentAsync(Document document, SyntaxNode node, CancellationToken c)
        {
            string doxygenComment = GetDoxygenComment(document.Name);

            var newNode = node.WithLeadingTrivia(
                SyntaxFactory.ParseLeadingTrivia(doxygenComment));

            return(AnalyzerUtil.ReplaceNode(node, newNode, document));
        }
        private Task <Document> AddMethodReturnsCommentAsync(Document document, BaseMethodDeclarationSyntax declaration, CancellationToken c)
        {
            var returnsComments = GetReturnComments(declaration);

            var leadingTrivias  = declaration.GetLeadingTrivia();
            var whitespaceCount = leadingTrivias[leadingTrivias.Count - 1].Span.Length;
            var newDeclaration  = declaration.WithLeadingTrivia(
                AnalyzerUtil.GetNewLeadingTrivia(leadingTrivias, returnsComments, whitespaceCount));

            return(AnalyzerUtil.ReplaceNode(declaration, newDeclaration, document));
        }