GNU bug report logs -
#16182
24.3.50; ruby-mode: Indentation style of multiline literals with hanging open paren inside other parens
Previous Next
Reported by: Dmitry Gutov <dgutov <at> yandex.ru>
Date: Wed, 18 Dec 2013 03:56:02 UTC
Severity: minor
Found in version 24.3.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
On 20.12.2013 17:46, Bozhidar Batsov wrote:
> On Friday, December 20, 2013 at 1:57 PM, Dmitry Gutov wrote:
>> On 20.12.2013 11:51, Bozhidar Batsov wrote:
>>> Just a small nitpick - everything that returns a value is actually an
>>> expression, not a statement.
>>
>> It can be both (see "expression statement"). This way it's not
>> ambiguous, because I'm really aligning to the statement: the containing
>> expression, which follows the bob or an [implicit] semicolon.
>>
>> In Rubocop, you've chosen to align to just the parent expression. Maybe
>> we should find a realistic example where one would be different from the
>> other.
> I don’t quite understand what you mean.
This example is indented just like Robocop master likes with (AlignWith:
variable):
b = a = if 3 == 4
1
else
2
end
puts a
puts b
Someone correct me if I'm wrong, but I suspect that users who like less
indentation would prefer to have the `if' body and closer to be aligned
to the beginning of the statement, rather than to `a'.
That's what ruby-mode does now if `if' is in `ruby-align-to-stmt-keywords'.
Another reason to pick this behavior is that "align to parent" is harder
to implement. SMIE has no AST: we can find the position of the parent
token (=), but finding the position of `a' will require manual seeking.
And `a' could be more than a plan variable: maybe something like
`b[a+1]' or `foo[:bar][:qux]`.
`=' is also not the only operator we can handle. Aside from its
variations (||=, etc), we might want to support `||' and others.
And the left side of `||' can be an arbitrary expression.
This bug report was last modified 11 years and 247 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.