On Saturday, April 21, 2018 at 4:06:45 AM UTC-4, Allen Wyma wrote:
>
> First of all, I'd like to say thanks so much for the elixir formatter. I
> do like nearly all of the defaults. There's one place that I would like to
> change:
>
> formatting of numbers.
>
> I'd like to be able to turn off the auto formatting of numbers to add in
> underscores after every third number.
>
> Reason:
> I do have some test data in my elixir files that I use to check
> information and when I search for certain test data by ID, which is a long
> number, it won't be found cause of the underscores added to the number.
>
> I can see this being useful if you're working with currency, or numbers
> with some meaning of counting; it does make the numbers easier to read, but
> if you're reading like an ID, then it becomes a big difficult to understand.
>
> %{ "specialId" => 100000002 } # => %{ "specialId" => 100_000_002 }
>
I wonder (just thinking out loud here) if we could leverage a type spec on
the number to tell the formatter to leave the number as is? I mean it
seems as if your issue is that it's treating what's essentially a long
string composed of only digits as a number rather than a string.
I agree with Louis' point. A formatter that allows for a lot of
customization rapidly loses the value of enforcing common conventions on
all code that's run through it.
--
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/d2eeb293-61b9-4139-84d7-49a7871522ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.