ruby-mode: Recognize instance or global var as first arg in parenless call

* lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p):
Recognize instance or global var as first arg in parenless call.

* test/lisp/progmodes/ruby-mode-resources/ruby.rb: Add example.
This commit is contained in:
Dmitry Gutov 2022-12-17 03:30:52 +02:00
parent 3356c0cb16
commit 1c0b90e5f7
2 changed files with 4 additions and 1 deletions

View file

@ -468,7 +468,7 @@ This only affects the output of the command `ruby-toggle-block'."
"else" "elsif" "do" "end" "and")
'symbols))))
(memq (car (syntax-after pos)) '(7 15))
(looking-at "[([]\\|[-+!~:]\\(?:\\sw\\|\\s_\\)")))))
(looking-at "[([]\\|[-+!~:@$]\\(?:\\sw\\|\\s_\\)")))))
(defun ruby-smie--before-method-name ()
;; Only need to be accurate when method has keyword name.

View file

@ -174,6 +174,9 @@ def test2 (arg)
bar,
:a
zzz @abc,
4
b = $:
c = ??