I need to format a class to ensure it's easily human readable. I have the syntax tree, the root CompilationUnitSyntax and the ClassDeclarationSyntax. I format the whitespace as follows.
root = root.ReplaceNode(classSyntax, classSyntax.NormalizeWhitespace(elasticTrivia: true));
syntaxTree = syntaxTree.WithRootAndOptions(root, syntaxTree.Options);
Before:
#region MyRegion
public class MyClass
{
// Info about MyClass
}
#endregion
After:
#region MyRegion
public class MyClass
{
// Info about MyClass
}#endregion
Why is the class's closing brace slammed into the #endregion?
If I run NormalizeWhitespace once more on the 'After' text, #endregion is moved back down onto its own line. Then a further call to NormalizeWhitespace moves it back up again. What is going on?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire