ruby-smie-rules: Fix misindentation of a method call after assignment

* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Fix indentation of a
method call after assignment with ruby-after-operator-indent=nil
(bug#61822).

* test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb:
Add corresponding example.
This commit is contained in:
Dmitry Gutov 2023-02-27 02:05:56 +02:00
parent 0fde314f6f
commit 267fc6d00c
2 changed files with 7 additions and 1 deletions

View file

@ -909,7 +909,9 @@ This only affects the output of the command `ruby-toggle-block'."
"<<=" ">>=" "&&=" "||=" "and" "or")) "<<=" ">>=" "&&=" "||=" "and" "or"))
(cond (cond
((not ruby-after-operator-indent) ((not ruby-after-operator-indent)
(ruby-smie--indent-to-stmt ruby-indent-level)) (ruby-smie--indent-to-stmt (if (smie-indent--hanging-p)
ruby-indent-level
0)))
((and (smie-rule-parent-p ";" nil) ((and (smie-rule-parent-p ";" nil)
(smie-indent--hanging-p)) (smie-indent--hanging-p))
ruby-indent-level))) ruby-indent-level)))

View file

@ -10,6 +10,10 @@
foo = obj.bar { |m| tee(m) } + foo = obj.bar { |m| tee(m) } +
obj.qux { |m| hum(m) } obj.qux { |m| hum(m) }
some_variable = abc + some_method(
some_argument
)
foo. foo.
bar bar
.baz .baz