It's possible to configure the elixir formate to avoid a single line?

I have a big static array and Elixir is adding each value into a new line :sweat_smile:
It’s possible to disable this just for this array?

Ideally, I would like to do this:

it’s a Go code that I’m porting to Elixir.

Nope. You can not change the behaviour of the formatter for this.

Perhaps just dumping the content to a file and loading this though metaprogramming at compile time might help you? You also should use @external_resource then.

2 Likes

I don’t think I’ve got any customizations, and mix format does what you want if you’re formatting a binary:

    <<0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
      0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
      0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
      0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
      0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F>>
1 Like

Disabling the formatter for a block would be useful in quite some cases. I know ocaml formatter has something like that and I love it.

1 Like