GNU bug report logs - #60321
29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sun, 25 Dec 2022 21:30:02 UTC

Severity: normal

Merged with 72099

Found in versions 29.0.60, 31.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Aaron Jensen <aaronjensen <at> gmail.com>
Cc: 60321 <at> debbugs.gnu.org
Subject: bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call
Date: Mon, 2 Sep 2024 03:19:40 +0300
[Message part 1 (text/plain, inline)]
On 01/09/2024 22:28, Aaron Jensen wrote:

> Here's a corrected patch for that particular example. Thank you for 
> finding that. I think I missed it because as long as you type the code 
> in, it indents fine. I still have a lot to understand about SMIE, so if 
> anything looks off in my patch, please let me know.

Thanks! Just being thorough. We can add this example to the args-indent 
test file, too.

Here's a bonus example which looks off but would be more difficult to 
fix (and it's not urgent, given the expression is in mixed styles):

foo([{
  a: 2
},
     {
       b: 3
     },
     4
    ])


It would be nice to at least handle the last arg correctly - maybe we'll 
just get that supported in the ts mode at some later date.

> I didn't change the default. I wasn't sure if you wanted to change the 
> defaults of all of the variables you added in the last round or just 
> this one, so I'll let you handle that the way you want to.

Sure. I think we can add this into Emacs 30 too, while the change is off 
by default.

A few other things:

* I think the docstring should say "Set it to nil to align to the line 
with the open bracket" - it doesn't necessarily align to the beginning 
of the statement (seems like a good thing).

* Let's change the first example to this, for less ambiguity?

  foo
    .update({
      key => value,
      other_key:
    }, {
      key => value,
      other_key:
    })


* Support for the new option in ruby-ts-mode (it's good to have parity). 
Could you take the attached patch for a spin? Seems to work here, but 
I'd like to have an extra confirmation.
[ruby-ts-bracketed-argument-indentation-option.diff (text/x-patch, attachment)]

This bug report was last modified 319 days ago.

Previous Next


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