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

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

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


From: Dmitry Gutov
Subject: bug#54702: 29.0.50; ruby-mode indentation: endless methods
Date: Fri, 16 Dec 2022 14:31:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

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.

Attachment: ruby-endless-methods.diff
Description: Text Data


reply via email to

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