GNU bug report logs - #32496
27.0.50; Strange indentation when ruby-align-chained-calls is t

Previous Next

Package: emacs;

Reported by: bruce.connor.am <at> gmail.com

Date: Wed, 22 Aug 2018 11:37:01 UTC

Severity: minor

Found in version 27.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Bozhidar Batsov" <bozhidar <at> batsov.dev>
To: "Lars Ingebrigtsen" <larsi <at> gnus.org>
Cc: 32496 <at> debbugs.gnu.org, Artur Malabarba <bruce.connor.am <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: bug#32496: 27.0.50;  Strange indentation when ruby-align-chained-calls is t
Date: Wed, 01 Sep 2021 13:02:56 +0300
[Message part 1 (text/plain, inline)]
Ah, I finally understood the issue at hand! It's really hard to discuss indentation problems in e-mail. :D

Yeah, I can confirm there's a bug when using (setq ruby-align-chained-calls t) in this example:

some_variable.where.not(x: nil)
                         .where(y: 2)

The two `where`s should be lined up, but currently the second `where` is lined up with the `not`.

some_variable.where.not(x: nil)
                                    .where(y: 2)

I can also confirm that the first behavior is what RuboCop (Ruby's popular linter/formatter) expects, when configured for aligned chained method calls. 

On Wed, Sep 1, 2021, at 12:53 PM, Lars Ingebrigtsen wrote:
> Bozhidar Batsov <bozhidar <at> batsov.com> writes:
> 
> > Sorry for the radio silence - I've been super busy lately. 
> >
> > It's hard for me to understand the indentation in the examples in the email
> > (as it seems the same to me). Very simply put - the idea is to align multi-line
> > chained calls on the `.`, as opposed to just nest them under the root receiver
> > as we'd normally do.
> >
> > I think Dmitry implemented this great and it's behaving just as it's supposed
> > to be behaving. Perhaps you misunderstood how this was supposed to
> > behave? What's the indentation you expected? 
> 
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
> 
> The examples were in HTML mail, so they were difficult to understand.
> 
> Emacs (with (setq ruby-align-chained-calls t)) currently aligns like
> this:
> 
> some_variable.where
>              .not(x: nil)
>              .where(y: 2)
> 
> Which is correct.  However, when there's a mixture of keeping things on
> one line and breaking, we get this:
> 
> some_variable.where.not(x: nil)
>                    .where(y: 2)
> 
> I think the bug reporter wants:
> 
> some_variable.where.not(x: nil)
>              .where(y: 2)
> 
> I.e., align multiline chained calls on the first dot, not the last?
> 
> (I don't know Ruby, so I have no opinion here.)
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
> 
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.