This will be interesting...
The strategy here will be to get the text for the macro, replace every $foo in the body of the macro with a string of the same length, e.g., xfoo. Then re-parse it and format it and convert the xfoos back to $foos (obvs we need to check that there is no xfoo in the body before substituting).
We'll need to format the decl of the macro, and find the body, I suppose, using token trees.
Google led me here. Is it worth closing this issue now, since rustfmt does have basic macro support?
Most helpful comment
The strategy here will be to get the text for the macro, replace every
$fooin the body of the macro with a string of the same length, e.g.,xfoo. Then re-parse it and format it and convert thexfoos back to$foos (obvs we need to check that there is noxfooin the body before substituting).We'll need to format the decl of the macro, and find the body, I suppose, using token trees.