Is it possible to indent in texstudio based on the levels? It seems that a proper macro might be able to do such a job, though it seems to be complicated.
Edit:
Thanks to Troy, we know that latexindent has this capacity.Therefore the problem is to write a macro which runs the latexindent on all file at once without causing problems.
latexindentdoes this. https://tex.stackexchange.com/a/351020/117534 – Troy Nov 05 '17 at 16:25