public static SyntaxToken Normalize(SyntaxToken token, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false) { Language language = token.Language(); var normalizer = new SyntaxNormalizer(language, token.FullSpan, language.SyntaxFacts.GetDeclarationDepth(token), indentWhitespace, eolWhitespace, useElasticTrivia); var result = normalizer.VisitToken(token); normalizer.Free(); return(result); }
public static TNode Normalize <TNode>(TNode node, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false) where TNode : SyntaxNode { Language language = node.Language(); var normalizer = new SyntaxNormalizer(language, node.FullSpan, language.SyntaxFacts.GetDeclarationDepth(node), indentWhitespace, eolWhitespace, useElasticTrivia); var result = (TNode)normalizer.Visit(node); normalizer.Free(); return(result); }
public static SyntaxTriviaList Normalize(SyntaxTriviaList trivia, string indentWhitespace, string eolWhitespace, bool useElasticTrivia = false) { Language language = trivia.Node.Language(); var normalizer = new SyntaxNormalizer(language, trivia.FullSpan, language.SyntaxFacts.GetDeclarationDepth(trivia.Token), indentWhitespace, eolWhitespace, useElasticTrivia); var result = normalizer.RewriteTrivia( trivia, language.SyntaxFacts.GetDeclarationDepth((SyntaxToken)trivia.ElementAt(0).Token), isTrailing: false, indentAfterLineBreak: false, mustHaveSeparator: false, lineBreaksAfter: 0); normalizer.Free(); return(result); }