Closed yowcow closed 4 years ago
Hi @yowcow,
Thank you for the issue and your PR, I looked at both of them.
The method I generally follow when deciding how something should be indented is that I look at how the Erlang mode of Emacs indents it and try to replicate that in vim-erlang-runtime. (Emacs's Erlang mode is shipped with Erlang/OTP itself, and most of the original developers of Erlang use Emacs, thus that is the de facto standard for indenting Erlang code.)
In this particular case, Emacs indents maps the way you propose. Since vim-erlang-runtime already indents records the "correct" way, I think this makes us very lucky now and we only need to add one letter to the indentation script to make maps behave that way.
Could you look at my commit 939f3f9? I copied your new tests too, but re-indented them.
Hi @hcs42, it looks perfect now!
I didn't notice the prev_term_plus
block but I should've looked for it as records were already working in that way.
Anyways, the code stays clean while working as expected, so I'm closing my PR.
Thanks!
Thanks for the feedback!
Issue closed by #45.
Current indentation of maps:
doesn't seem quite right in 2 cases, when a map is:
Examples:
For consistency, maps look so much better when indented as something similar to:
so that maps align better with other types of opening and closing brackets/parens in a list or a function: