Skip to main content

SyntaxExtensions.TrimTrivia Method

Containing Type: SyntaxExtensions

Assembly: Roslynator.CSharp.dll

Overloads

MethodSummary
TrimTrivia(SyntaxToken)Removes all leading whitespace from the leading trivia and all trailing whitespace from the trailing trivia and returns a new token with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same token if there is nothing to trim.
TrimTrivia<TNode>(SeparatedSyntaxList<TNode>)Removes all leading whitespace from the leading trivia of the first node in a list and all trailing whitespace from the trailing trivia of the last node in a list and returns a new list with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace.
TrimTrivia<TNode>(SyntaxList<TNode>)Removes all leading whitespace from the leading trivia of the first node in a list and all trailing whitespace from the trailing trivia of the last node in a list and returns a new list with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace.
TrimTrivia<TNode>(TNode)Removes all leading whitespace from the leading trivia and all trailing whitespace from the trailing trivia and returns a new node with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same node if there is nothing to trim.

TrimTrivia(SyntaxToken)

Removes all leading whitespace from the leading trivia and all trailing whitespace from the trailing trivia and returns a new token with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same token if there is nothing to trim.

public static Microsoft.CodeAnalysis.SyntaxToken TrimTrivia(this Microsoft.CodeAnalysis.SyntaxToken token)

Parameters

token SyntaxToken

Returns

SyntaxToken

TrimTrivia<TNode>(SeparatedSyntaxList<TNode>)

Removes all leading whitespace from the leading trivia of the first node in a list and all trailing whitespace from the trailing trivia of the last node in a list and returns a new list with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace.

public static Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode> TrimTrivia<TNode>(this Microsoft.CodeAnalysis.SeparatedSyntaxList<TNode> list) where TNode : Microsoft.CodeAnalysis.SyntaxNode

Type Parameters

TNode

Parameters

list SeparatedSyntaxList<TNode>

Returns

SeparatedSyntaxList<TNode>

TrimTrivia<TNode>(SyntaxList<TNode>)

Removes all leading whitespace from the leading trivia of the first node in a list and all trailing whitespace from the trailing trivia of the last node in a list and returns a new list with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace.

public static Microsoft.CodeAnalysis.SyntaxList<TNode> TrimTrivia<TNode>(this Microsoft.CodeAnalysis.SyntaxList<TNode> list) where TNode : Microsoft.CodeAnalysis.SyntaxNode

Type Parameters

TNode

Parameters

list SyntaxList<TNode>

Returns

SyntaxList<TNode>

TrimTrivia<TNode>(TNode)

Removes all leading whitespace from the leading trivia and all trailing whitespace from the trailing trivia and returns a new node with the new trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same node if there is nothing to trim.

public static TNode TrimTrivia<TNode>(this TNode node) where TNode : Microsoft.CodeAnalysis.SyntaxNode

Type Parameters

TNode

Parameters

node TNode

Returns

TNode