Closed thecodeboss closed 7 years ago
Hi @thecodeboss!
They can't match because the formatter is based on a string, which gives us a lot more context, and the macro one relies on the AST. furthermore, Macro.to_string was designed to allow the result to be processed as we convert it to string, which would be tricky in the formatter.
TL;DR - different tools, different outputs.
have a good weekend!
To further clarify, we are not against improving the output of Macro.to_string, you just shouldn't expect them ever to be the same.
Environment
Elixir 1.6.0-dev (794928e) (compiled with OTP 20)
MacOS High Sierra 10.13
The output looks like:
Expected behavior
The output should match the format that the Elixir code formatter uses. In this case:
This is definitely a "nice to have" thing, obviously not urgent or required. I couldn't find any other issues related to this one, nor any discussions about whether it has already been considered. My apologies if this is a non-goal.