コード例 #1
0
        public static TNode RemoveTrivia <TNode>(TNode node, TextSpan?span = null) where TNode : SyntaxNode
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            return((TNode)TriviaRemover.GetInstance(span).Visit(node));
        }
コード例 #2
0
        public static TNode RemoveTrivia <TNode>(TNode node) where TNode : SyntaxNode
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            return(TriviaRemover.RemoveTrivia(node));
        }
コード例 #3
0
        public static async Task <Document> RemoveTriviaAsync(
            this Document document,
            TextSpan span,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            SyntaxNode root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

            SyntaxNode newRoot = TriviaRemover.RemoveTrivia(root, span);

            return(document.WithSyntaxRoot(newRoot));
        }