enhanced-ruby-mode icon indicating copy to clipboard operation
enhanced-ruby-mode copied to clipboard

Paren-less multi-line method call indentation is wrong

Open Eilie opened this issue 9 years ago • 9 comments

Currenlty:

foo very_long_arg_1: "value", very_long_arg_2: "value",
  very_long_arg_3: "value"

Should be:

foo very_long_arg_1: "value", very_long_arg_2: "value",
    very_long_arg_3: "value"

Eilie avatar May 29 '15 22:05 Eilie

Any update on this issue? It's rather annoying :smile:

fibrasek avatar May 08 '19 20:05 fibrasek

@Fibrasek patches welcome.

zenspider avatar May 13 '19 01:05 zenspider

@zenspider can you point me where to start? I'll be glad to fix this it'll be a good way to practice my elisp :)

fibrasek avatar May 24 '19 17:05 fibrasek

I just ran into this as well. It seems parenthesis around parameters do not make a difference. Current erm indents multi-line parameter lists like this:

  foo(1,
    2,
    3,
    4)

Or without parens:

  foo 1,
    2,
    3,
    4

I would like to indent such calls like this:

  foo(1,
      2,
      3,
      4)

Is there a setting I am missing? Otherweise I would appreciate a pointer on where to look. :-)

nmk avatar Nov 28 '19 21:11 nmk

@nmk Take a look at M-x enh-ruby-add-indent-file-local-variables

Here's what I have, with all the defaults:

foo(1,
    2,
    3,
    4)

foo 1,
  2,
  3,
  4

# Local Variables:
# enh-ruby-bounce-deep-indent: nil
# enh-ruby-deep-indent-construct: t
# enh-ruby-deep-indent-paren: t
# enh-ruby-hanging-brace-deep-indent-level: 0
# enh-ruby-hanging-brace-indent-level: 2
# enh-ruby-hanging-indent-level: 2
# enh-ruby-hanging-paren-deep-indent-level: 0
# enh-ruby-hanging-paren-indent-level: 2
# enh-ruby-indent-level: 2
# enh-ruby-indent-tabs-mode: nil
# enh-ruby-preserve-indent-in-heredocs: nil
# End:

Indenting that whole file indents as you want with the parens. You might have some settings that go against that, so try first with these settings, and then M-x enh-ruby-del-file-local-variables and see how it indents after.

zenspider avatar Nov 28 '19 23:11 zenspider

@Fibrasek clone the repo, try rake to see if all the tests pass... assuming they do, dig into the tests. They're pretty straightforward.

zenspider avatar Nov 28 '19 23:11 zenspider

@nmk I should add: M-x enh-ruby-add-file-local-variables only adds the variables that you have that are different from the defaults, so maybe start there.

zenspider avatar Nov 28 '19 23:11 zenspider

@zenspider I'll look into it, thanks!

fibrasek avatar Jan 24 '20 20:01 fibrasek

AFAICT, this is working fine for me. It seems obvious that nobody wants to patch this to work the way OP described. So should this ticket be closed?

zenspider avatar Nov 06 '22 19:11 zenspider