public override SyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node) { var originalList = node.ChildNodesAndTokens(); for (int i = 0; i < originalList.Count; i++) { if (!originalList[i].IsNode) { continue; } if (AreNodesEqual(this._remover.LastCustomSelector, originalList[i].AsNode())) { var oldToken = originalList[i + 1].AsToken(); var newToken = oldToken.WithTrailingTrivia(oldToken.TrailingTrivia .Add(SyntaxExtenders.EndOfLineTrivia) .Add(SyntaxFactory.Comment(CustomCodeCommentEnd)) .Add(SyntaxExtenders.EndOfLineTrivia)); return(base.VisitInitializerExpression(node.ReplaceToken(oldToken, newToken))); } } return(base.VisitInitializerExpression(node)); }
public override SyntaxNode VisitInitializerExpression(InitializerExpressionSyntax node) { return(node.ReplaceToken(node.OpenBraceToken, SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.OpenBraceToken, this.GenerateCommentsTrivia()))); }