public override SyntaxNode VisitFieldDeclaration(FieldDeclarationSyntax node) { node = (FieldDeclarationSyntax)base.VisitFieldDeclaration(node); if ((Options & WrapRewriterOptions.IndentFieldInitializer) != 0) { SyntaxToken equalsToken = node.Declaration.Variables[0].Initializer.EqualsToken; int count = _maxFieldDeclarationLength - (equalsToken.SpanStart - node.SpanStart); SyntaxToken newEqualsToken = equalsToken.AppendToLeadingTrivia(Whitespace(new string(' ', count))); node = node.ReplaceToken(equalsToken, newEqualsToken); } if ((Options & WrapRewriterOptions.WrapArguments) != 0) { return(node.AppendToTrailingTrivia(NewLine())); } else { return(node); } }
public static SyntaxToken AppendEndOfLineToLeadingTrivia(this SyntaxToken token) { SyntaxTrivia endOfLine = SyntaxTriviaAnalysis.GetEndOfLine(token); return(token.AppendToLeadingTrivia(endOfLine)); }