Since we are building the formatted code from AST items we may need to have a common way of building the formatted code (something like a CodeBuilder that keeps track of the current indentation level). So that we can build the code with correct indentations.
I can see this kind of logic is present in the current formatter but would love to discuss if there are other ways we can reconstruct the code with correct indentations.
If this is indeed something we need I can implement it before #1873
cc @eureka-cpu