Skip to main content

SyntaxExtensions.TrimLeadingTrivia Method

Containing Type: SyntaxExtensions

Assembly: Roslynator.CSharp.dll

Overloads​

MethodSummary
TrimLeadingTrivia(SyntaxToken)Removes all leading whitespace from the leading trivia and returns a new token with the new leading trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same token if there is nothing to trim.
TrimLeadingTrivia<TNode>(TNode)Removes all leading whitespace from the leading trivia and returns a new node with the new leading trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same node if there is nothing to trim.

TrimLeadingTrivia(SyntaxToken)​

Removes all leading whitespace from the leading trivia and returns a new token with the new leading 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 TrimLeadingTrivia(this Microsoft.CodeAnalysis.SyntaxToken token)

Parameters​

token   SyntaxToken

Returns​

SyntaxToken

TrimLeadingTrivia<TNode>(TNode)​

Removes all leading whitespace from the leading trivia and returns a new node with the new leading 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 TrimLeadingTrivia<TNode>(this TNode node) where TNode : Microsoft.CodeAnalysis.SyntaxNode

Type Parameters​

TNode

Parameters​

node   TNode

Returns​

TNode