Which build of elm-format support 2 space indentation instead of 4 spaces? At this time, I have installed elm-format-0.17-0.3.1-alpha-mac-x64.
Sorry, elm-format does not support 2-space indentation.
Is there any reason for choosing 4 spaces instead of 2? It seems a big chunk of the code online, as well as most examples on elm-lang.org, are using 2 spaces. Now, I do like the idea of having consistent style throughout the language, but some code becomes simply unreadable. A simple pattern matching within a let expression will be moved by 16 spaces. Compare:
myFunction =
let
foo bar =
case bar of
X -> ...
with
myFunction =
let
foo bar =
case bar of
X -> ...
If 4 spaces was a hard requirement and I could bend others, I would have rewritten the code as follows:
myFunction =
let foo bar = case bar of
X -> ...
but this would break a lot of sensible conventions actually mentioned in the official docs.
I'm using large font, small screen and low soft character limit (80 characters), so this feel particularly painful.
Discussion of the reasoning was at https://github.com/avh4/elm-format/issues/158 and various mailing list threads.
Can this be a config option?
@elliotdickison If there is config options there's no reason to use elm-format. The example by @Dremora isn't even covering 1/10 of my screen
@benjick: it wasn't about how much screen it covers, it's about readability.
@benjick I did not notice that example, but TBH I think it's irrelevant. It's hard to make an argument that this comes down to anything more than personal preference. I like 2 spaces for aesthetic reasons, but it's fine by me if you want to use 4. I think elm-format is a great tool and I would love to configure it to fit my current workflow, but if the whole point is universal conformity then you're right, config doesn't make any sense.
Closing: (the original question has been answered)
Most helpful comment
Discussion of the reasoning was at https://github.com/avh4/elm-format/issues/158 and various mailing list threads.