GNU bug report logs -
#54702
29.0.50; ruby-mode indentation: endless methods
Previous Next
Reported by: Aaron Jensen <aaronjensen <at> gmail.com>
Date: Mon, 4 Apr 2022 02:04:02 UTC
Severity: normal
Found in version 29.0.50
Fixed in version 29.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 16/12/2022 07:07, Aaron Jensen wrote:
>> 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.
Right, thanks. See the attached updated patch.
>>> 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.
Thanks! The implementation (on top of the patch here) looks trivial, the
question is whether to add an option, or just change the behavior and
treat it like a "fix". Let's continue there after closing this one.
> Unrelated, but I'm excited about the prospect of a treesit mode for Ruby.
Yeah, it looks promising, but let's see how it goes.
And there is a certain barrier to compiling the tree-sitter stuff, so
we'll probably need to maintain the current/pure version in parallel for
a while.
[ruby-endless-methods.diff (text/x-patch, attachment)]
This bug report was last modified 2 years and 213 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.