Subject: Re: bug#54702: 29.0.50; ruby-mode indentation: endless methods

From: Aaron Jensen <[email-masked]>
Date: Fri, 16 Dec 2022 00:07:07 -0500

On Thu, Dec 15, 2022 at 7:33 PM Dmitry Gutov <[email-masked]> wrote:
>
> Hi Aaron,
>
> Sorry for the long pause. You said you're using something else, though,
> so it didn't seem urgent (and I've yet to encounter endless methods at
> $day_job, FWIW).

Not a problem at all. Our project is very data heavy and we define
lots of one line methods, so we have made good use of them.

> Not a problem for me, but could you test the attached patch anyway?
>
> It seems to handle a bunch of different/complex cases fine without
> regressions, but it's always better with a second pair of eyes.

Sure. I tried a few things and the only problem I can find is that it
does not handle endless module methods:

def self.some_method =
  "some-value"

(with or without the line break, it handles them as the unpatched
version handles instance endless methods.

> > I'd probably use ruby-mode if
> > it supported indenting long parameter/argument lists the way the
> > non-smie version does, like this:
> >
> > def some_method(
> >    some_param,
> >    some_other_param
> > )
>
> Now that the SMIE stuff is again in my short-term memory, it shouldn't
> be too hard. Just please file a separate bug report (slash feature
> request) with a precise example. Bonus points for linking to a relevant
> Rubocop rule, so that we can pick a better name for the new user option.

Sure thing, just sent one in: bug#60110

> I don't see the non-SMIE version indenting it like this -- it looks more
> like this instead (and only if I set ruby-deep-indent-paren to nil):
>
> def test2 (
>      asd,
>      asd
>      asd
>      )
>
> So let's start with a couple of good examples.

Yeah, this is what I see too. Not sure what I saw before. In any case,
I sent a current/desired.

> My main problem with it is the spotty maintenance like in this example:
> https://github.com/zenspider/enhanced-ruby-mode/issues/96
>
> But it might work fine for many people. Especially those who don't use Robe.
>
> Some previous versions of it (probably by the previous maintainer) were
> really broken, so I just took up ruby-mode instead. I haven't tried
> using its latest versions much.

Copy that. It works well for me. My endless method patch has since been merged.

Unrelated, but I'm excited about the prospect of a treesit mode for Ruby.

Thanks again,

Aaron