|
From: | Dmitry Gutov |
Subject: | bug#16182: Acknowledgement (24.3.50; ruby-mode: Indentation style of multiline literals with hanging open paren inside other parens) |
Date: | Sat, 21 Dec 2013 17:31:14 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
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 bSomeone 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.
[Prev in Thread] | Current Thread | [Next in Thread] |