I think this is a great idea. I think we can break this problem in two: 1. Improve the readability of arguments in stacktraces (without color). We should probably break them into newlines by default. A PR for this is welcome.
2. Once we do that, we discuss and reassess the need for coloring. WDYT? On Wed, Jan 6, 2021 at 1:25 PM [email protected] < [email protected]> wrote: > Hello, > > This is a wide topic and I am going to illustrate it with one example > from ExUnit. > > Sometimes when a test fails, especially when `%Plug.Conn{}` is one of the > arguments, in the stacktrace the reported function call is shown. The issue > is that when there is a big map/struct as an argument and a few other > arguments, it is very hard to see where one function argument ends and > another starts. > > One approach to improve the experience in this case is to paint the > arguments in different colors. > Here is an artificial example that shows the problem. > Take a look at the %SomeModule.three_arg_function/3 function that takes 3 > arguments - %Plug.Conn{}, map and %Plug.Conn{}. > > Without any visual distinction in the terminal you would see something > like this: https://ibb.co/NnqMc1T > > But if we throw some colors in, the arguments are clearly distinguished: > https://ibb.co/NnXYfcn > > This ability to better visually distinguish the arguments can be applied > in a wide variety of situations and not only in the ExUnit stacktrace. The > problem can be solved in different ways that can be applied either > separately or combined. One such another "trick" I use to better understand > what happens is to copy the function header in a file and replace `\n` with > actual new lines. > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/d984f624-9aa9-43c1-b553-f6a9883259dcn%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/d984f624-9aa9-43c1-b553-f6a9883259dcn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2Bt63PWT6O%2BYL2evX4-ALusb%2BVtm69xhF%2Bh6GVuYiHapQ%40mail.gmail.com.
