How to increase printable_limit from Macro.to_string()?

Hello all,

I need to convert AST with possible long binary to string.
Macro.to_string() uses Inspect and Inspect has the printable_limit option set to 4096 for binaries by default.
I am looking for the way to increase it so binary will not be truncated on to_string()

Thanks,
Serge

This seems like a bug in Macro.to_string to me - it should print everything out. Could you open a bug report?

1 Like

Done
https://github.com/elixir-lang/elixir/issues/7545

Thank you,
Serge

I believe this is already fixed in master. Until that’s released you can do

Macro.to_string(v, fn
  node, _ when is_binary(node) -> inspect(node, printable_limit: :infinity)
  _, string -> string
end)
4 Likes