private static void Write( ExpressionSyntax expression, ExpressionSyntax nextExpression, SyntaxToken token, string newText, SyntaxNodeTextBuilder builder) { if (FormatConditionalExpressionAnalyzer.IsFixable(expression, token)) { if (!expression.GetTrailingTrivia().IsEmptyOrWhitespace() || !token.LeadingTrivia.IsEmptyOrWhitespace()) { builder.AppendTrailingTrivia(expression); builder.AppendLeadingTrivia(token); } builder.AppendTrailingTrivia(token); builder.AppendLeadingTrivia(nextExpression); builder.Append(newText); builder.AppendSpan(nextExpression); } else { builder.AppendTrailingTrivia(expression); builder.AppendFullSpan(token); builder.AppendLeadingTriviaAndSpan(nextExpression); } }
private static void Write( ExpressionSyntax expression, ExpressionSyntax nextExpression, SyntaxToken token, string newText, SyntaxNodeTextBuilder builder) { if (IsFixable(expression, token)) { if (expression.GetTrailingTrivia().Any(f => !f.IsWhitespaceOrEndOfLineTrivia()) || token.LeadingTrivia.Any(f => !f.IsWhitespaceOrEndOfLineTrivia())) { builder.AppendTrailingTrivia(expression); builder.AppendLeadingTrivia(token); } builder.AppendTrailingTrivia(token); builder.AppendLeadingTrivia(nextExpression); builder.Append(newText); builder.AppendSpan(nextExpression); } else { builder.AppendTrailingTrivia(expression); builder.AppendFullSpan(token); builder.AppendLeadingTriviaAndSpan(nextExpression); } }