bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg


From: Dmitry Gutov
Subject: bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call
Date: Tue, 27 Dec 2022 03:16:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 26/12/2022 01:46, Aaron Jensen wrote:

enh-ruby-mode and vim do the same thing, which I think is fine:

takes_multi_pairs_hash(x: {
   a: 1,
   b: 2
})

Makes sense to me, I just wanted to keep this case in the bug report because it will likely need a separate indentation rule or a separate clause.

and_in_a_method_call({
    no: :difference
},
foo,
bar)

enh-ruby-mode:

and_in_a_method_call({
   no: :difference
},
                      foo,
                      bar)


Vim:

and_in_a_method_call({
   no: :difference
},
foo,
bar)

Vim's choice looks saner to my eye. Probably comes down to the choice of indentation algorithm, though.

I think this falls under something I wouldn't put too much effort into
fixing. I would write it like this:

and_in_a_method_call(
   {
     no: :difference
   },
   foo,
   bar
)

Which indents in a straightforward manner.

Indeed. But this works already, no changes required.

If I had to type it as above, I would probably indent it like this:

and_in_a_method_call({
     no: :difference
   },
   foo,
   bar)

But I can't imagine that would be easy to implement at all, so I
wouldn't bother.

The indentation logic itself might be not that difficult to write, but the fact that the expression will have to be reindented as soon as the method call grows a second argument (after the user types the comma?), makes it a hard sell usability-wise.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]