Пример #1
0
 public override SyntaxTrivia VisitTrivia(SyntaxTrivia trivia)
 {
     if (_span == null || _span.Value.Contains(trivia.Span))
     {
         return(CSharpFactory.EmptyWhitespace());
     }
     else
     {
         return(base.VisitTrivia(trivia));
     }
 }
Пример #2
0
        public override SyntaxTrivia VisitTrivia(SyntaxTrivia trivia)
        {
            TextSpan span = trivia.Span;

            if (Span.Contains(span))
            {
                switch (trivia.Kind())
                {
                case SyntaxKind.SingleLineCommentTrivia:
                case SyntaxKind.MultiLineCommentTrivia:
                {
                    if (RemoveOptions != CommentRemoveOptions.Documentation)
                    {
                        return(CSharpFactory.EmptyWhitespace());
                    }

                    break;
                }

                case SyntaxKind.SingleLineDocumentationCommentTrivia:
                case SyntaxKind.MultiLineDocumentationCommentTrivia:
                {
                    if (RemoveOptions != CommentRemoveOptions.AllExceptDocumentation)
                    {
                        return(CSharpFactory.EmptyWhitespace());
                    }

                    break;
                }

                case SyntaxKind.EndOfLineTrivia:
                {
                    if (RemoveOptions != CommentRemoveOptions.Documentation &&
                        ShouldRemoveEndOfLine(span))
                    {
                        return(CSharpFactory.EmptyWhitespace());
                    }

                    break;
                }
                }
            }

            return(base.VisitTrivia(trivia));
        }