All three of ruby-mode, java-mode, and c-mode indent a simple arithmetic expression broken into lines like this:
foodog = 12 + 4 *
18 * 99 + 8
I think this is the Java sample which has the indent set to 4. I’ll call this “the old way”.
All three of ruby-ts-mode, java-ts-mode, and c-ts-mode indent it like this:
variable = 12 + 4 *
18 * 99 + 8
In Ruby’s case, this rule is doing it:
((parent-is "binary") first-sibling 0)
If I comment that rule out, then no rule hits and so there is no indent (the line is left unchanged no matter how it is indented).
While I think the new way is ultra cool… I am 100% positive I am in the vast minority on this topic. Most prefer to have it indented the old way.
I’ve developed two new rules but I believe these will not solve the issue 100%:
((ancestor-is "parenthesized_statements") (ancestor "parenthesized_statements") 1)
((ancestor-is "assignment") (ancestor "assignment") ruby-ts-mode-indent-offset)
I also wrote ancestor-is and ancestor so now I get:
eddie = (a + b *
c * d + 12)
bobby = a + b *
c * d + 12
I fear as I test and play with this more I’m going to need more rules to catch all the cases where a line starts with a term of an arithmetic expression.
Perry