ruby-mode: Fix method call indentation in rhs of multiple assignment

* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Special-case
assignment that follows a comma-separated list (bug#61871).

* test/lisp/progmodes/ruby-mode-resources/ruby.rb: Add case.
This commit is contained in:
Dmitry Gutov 2023-02-28 23:00:42 +02:00
parent 16d012cf3b
commit 48a0804d10
2 changed files with 13 additions and 5 deletions

View file

@ -916,11 +916,14 @@ This only affects the output of the command `ruby-toggle-block'."
(smie-indent--hanging-p)) (smie-indent--hanging-p))
ruby-indent-level))) ruby-indent-level)))
(`(:before . "=") (`(:before . "=")
(save-excursion (or
(and (smie-rule-parent-p " @ ") (save-excursion
(goto-char (nth 1 (smie-indent--parent))) (and (smie-rule-parent-p " @ ")
(smie-rule-prev-p "def=") (goto-char (nth 1 (smie-indent--parent)))
(cons 'column (+ (current-column) ruby-indent-level -3))))) (smie-rule-prev-p "def=")
(cons 'column (+ (current-column) ruby-indent-level -3))))
(and (smie-rule-parent-p ",")
(smie-rule-parent))))
(`(:after . ,(or "?" ":")) (`(:after . ,(or "?" ":"))
(if ruby-after-operator-indent (if ruby-after-operator-indent
ruby-indent-level ruby-indent-level

View file

@ -163,6 +163,11 @@ def test2 (arg)
) )
end end
# Bug#61871
foo, bar = baz.(
some_arg
)
# Bug#17097 # Bug#17097
if x == :!= if x == :!=
something something