Skip to main content

SyntaxExtensions Class

Namespace: Roslynator

Assembly: Roslynator.Core.dll

A set of extension method for a syntax.

public static class SyntaxExtensions

Methods

MethodSummary
All(SyntaxTokenList, Func<SyntaxToken, Boolean>)Returns true if all tokens in a SyntaxTokenList matches the predicate.
All(SyntaxTriviaList, Func<SyntaxTrivia, Boolean>)Returns true if all trivia in a SyntaxTriviaList matches the predicate.
All<TNode>(SeparatedSyntaxList<TNode>, Func<TNode, Boolean>)Returns true if all nodes in a list matches the predicate.
All<TNode>(SyntaxList<TNode>, Func<TNode, Boolean>)Returns true if all nodes in a list matches the predicate.
Any(SyntaxTokenList, Func<SyntaxToken, Boolean>)Returns true if any token in a SyntaxTokenList matches the predicate.
Any(SyntaxTriviaList, Func<SyntaxTrivia, Boolean>)Returns true if any trivia in a SyntaxTriviaList matches the predicate.
Any<TNode>(SeparatedSyntaxList<TNode>, Func<TNode, Boolean>)Returns true if any node in a list matches the predicate.
Any<TNode>(SyntaxList<TNode>, Func<TNode, Boolean>)Returns true if any node in a list matches the predicate.
AppendToLeadingTrivia(SyntaxToken, IEnumerable<SyntaxTrivia>)Creates a new token from this token with the leading trivia replaced with a new trivia where the specified trivia is added at the end of the leading trivia.
AppendToLeadingTrivia(SyntaxToken, SyntaxTrivia)Creates a new token from this token with the leading trivia replaced with a new trivia where the specified trivia is added at the end of the leading trivia.
AppendToLeadingTrivia<TNode>(TNode, IEnumerable<SyntaxTrivia>)Creates a new node from this node with the leading trivia replaced with a new trivia where the specified trivia is added at the end of the leading trivia.
AppendToLeadingTrivia<TNode>(TNode, SyntaxTrivia)Creates a new node from this node with the leading trivia replaced with a new trivia where the specified trivia is added at the end of the leading trivia.
AppendToTrailingTrivia(SyntaxToken, IEnumerable<SyntaxTrivia>)Creates a new token from this token with the trailing trivia replaced with a new trivia where the specified trivia is added at the end of the trailing trivia.
AppendToTrailingTrivia(SyntaxToken, SyntaxTrivia)Creates a new token from this token with the trailing trivia replaced with a new trivia where the specified trivia is added at the end of the trailing trivia.
AppendToTrailingTrivia<TNode>(TNode, IEnumerable<SyntaxTrivia>)Creates a new node from this node with the trailing trivia replaced with a new trivia where the specified trivia is added at the end of the trailing trivia.
AppendToTrailingTrivia<TNode>(TNode, SyntaxTrivia)Creates a new node from this node with the trailing trivia replaced with a new trivia where the specified trivia is added at the end of the trailing trivia.
Contains(SyntaxTokenList, SyntaxToken)Returns true if the specified token is in the SyntaxTokenList.
Contains<TNode>(SeparatedSyntaxList<TNode>, TNode)Returns true if the specified node is in the SeparatedSyntaxList<TNode>.
Contains<TNode>(SyntaxList<TNode>, TNode)Returns true if the specified node is in the SyntaxList<TNode>.
ContainsDirectives(SyntaxNode, TextSpan)Returns true if the node contains any preprocessor directives inside the specified span.
DescendantTrivia<TNode>(SyntaxList<TNode>, Func<SyntaxNode, Boolean>, Boolean)Get a list of all the trivia associated with the nodes in the list.
DescendantTrivia<TNode>(SyntaxList<TNode>, TextSpan, Func<SyntaxNode, Boolean>, Boolean)Get a list of all the trivia associated with the nodes in the list.
FirstAncestor<TNode>(SyntaxNode, Func<TNode, Boolean>, Boolean)Returns the first node of type TNode that matches the predicate.
FirstDescendant<TNode>(SyntaxNode, Func<SyntaxNode, Boolean>, Boolean)Searches a list of descendant nodes in prefix document order and returns first descendant of type TNode.
FirstDescendant<TNode>(SyntaxNode, TextSpan, Func<SyntaxNode, Boolean>, Boolean)Searches a list of descendant nodes in prefix document order and returns first descendant of type TNode.
FirstDescendantOrSelf<TNode>(SyntaxNode, Func<SyntaxNode, Boolean>, Boolean)Searches a list of descendant nodes (including this node) in prefix document order and returns first descendant of type TNode.
FirstDescendantOrSelf<TNode>(SyntaxNode, TextSpan, Func<SyntaxNode, Boolean>, Boolean)Searches a list of descendant nodes (including this node) in prefix document order and returns first descendant of type TNode.
GetLeadingAndTrailingTrivia(SyntaxNode)Returns leading and trailing trivia of the specified node in a single list.
GetTrailingSeparator<TNode>(SeparatedSyntaxList<TNode>)Returns the trailing separator, if any.
HasTrailingSeparator<TNode>(SeparatedSyntaxList<TNode>)Returns true if the specified list contains trailing separator.
IndexOf(SyntaxTokenList, Func<SyntaxToken, Boolean>)Searches for a token that matches the predicate and returns the zero-based index of the first occurrence within the entire SyntaxTokenList.
IndexOf(SyntaxTriviaList, Func<SyntaxTrivia, Boolean>)Searches for a trivia that matches the predicate and returns the zero-based index of the first occurrence within the entire SyntaxTriviaList.
IsFirst<TNode>(SeparatedSyntaxList<TNode>, TNode)Returns true if the specified node is a first node in the list.
IsFirst<TNode>(SyntaxList<TNode>, TNode)Returns true if the specified node is a first node in the list.
IsLast<TNode>(SeparatedSyntaxList<TNode>, TNode)Returns true if the specified node is a last node in the list.
IsLast<TNode>(SyntaxList<TNode>, TNode)Returns true if the specified node is a last node in the list.
LeadingAndTrailingTrivia(SyntaxToken)Returns leading and trailing trivia of the specified node in a single list.
PrependToLeadingTrivia(SyntaxToken, IEnumerable<SyntaxTrivia>)Creates a new token from this token with the leading trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the leading trivia.
PrependToLeadingTrivia(SyntaxToken, SyntaxTrivia)Creates a new token from this token with the leading trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the leading trivia.
PrependToLeadingTrivia<TNode>(TNode, IEnumerable<SyntaxTrivia>)Creates a new node from this node with the leading trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the leading trivia.
PrependToLeadingTrivia<TNode>(TNode, SyntaxTrivia)Creates a new node from this node with the leading trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the leading trivia.
PrependToTrailingTrivia(SyntaxToken, IEnumerable<SyntaxTrivia>)Creates a new token from this token with the trailing trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the trailing trivia.
PrependToTrailingTrivia(SyntaxToken, SyntaxTrivia)Creates a new token from this token with the trailing trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the trailing trivia.
PrependToTrailingTrivia<TNode>(TNode, IEnumerable<SyntaxTrivia>)Creates a new node from this node with the trailing trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the trailing trivia.
PrependToTrailingTrivia<TNode>(TNode, SyntaxTrivia)Creates a new node from this node with the trailing trivia replaced with a new trivia where the specified trivia is inserted at the beginning of the trailing trivia.
ReplaceAt(SyntaxTokenList, Int32, SyntaxToken)Creates a new SyntaxTokenList with a token at the specified index replaced with a new token.
ReplaceAt(SyntaxTriviaList, Int32, SyntaxTrivia)Creates a new SyntaxTriviaList with a trivia at the specified index replaced with new trivia.
ReplaceAt<TNode>(SeparatedSyntaxList<TNode>, Int32, TNode)Creates a new list with a node at the specified index replaced with a new node.
ReplaceAt<TNode>(SyntaxList<TNode>, Int32, TNode)Creates a new list with the node at the specified index replaced with a new node.
SpanContainsDirectives(SyntaxNode)Returns true if the node's span contains any preprocessor directives.
TryGetContainingList(SyntaxTrivia, SyntaxTriviaList, Boolean, Boolean)Gets a SyntaxTriviaList the specified trivia is contained in.
WithoutLeadingTrivia(SyntaxNodeOrToken)Creates a new SyntaxNodeOrToken with the leading trivia removed.
WithoutLeadingTrivia(SyntaxToken)Creates a new token from this token with the leading trivia removed.
WithoutTrailingTrivia(SyntaxNodeOrToken)Creates a new SyntaxNodeOrToken with the trailing trivia removed.
WithoutTrailingTrivia(SyntaxToken)Creates a new token from this token with the trailing trivia removed.
WithoutTrivia(SyntaxNodeOrToken)Creates a new SyntaxNodeOrToken from this node without leading and trailing trivia.
WithTriviaFrom(SyntaxToken, SyntaxNode)Creates a new token from this token with both the leading and trailing trivia of the specified node.
WithTriviaFrom<TNode>(SeparatedSyntaxList<TNode>, SyntaxNode)Creates a new separated list with both leading and trailing trivia of the specified node. If the list contains more than one item, first item is updated with leading trivia and last item is updated with trailing trivia.
WithTriviaFrom<TNode>(SyntaxList<TNode>, SyntaxNode)Creates a new list with both leading and trailing trivia of the specified node. If the list contains more than one item, first item is updated with leading trivia and last item is updated with trailing trivia.
WithTriviaFrom<TNode>(TNode, SyntaxToken)Creates a new node from this node with both the leading and trailing trivia of the specified token.