* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Consider the case when there are no arguments inside the call yet.
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-indent-call-no-args): Add test.
((and (query "(argument_list \"(\" _ @indent)")
(node-is ")"))
ruby-ts--parent-call-or-bol 0)
- ((query "(argument_list \"(\" _ @indent)")
+ ((or (query "(argument_list \"(\" _ @indent)")
+ ;; No arguments yet; NODE is nil in that case.
+ (match "\\`\\'" "argument_list"))
ruby-ts--parent-call-or-bol ruby-indent-level)
;; 3) No paren, ruby-parenless-call-arguments-indent is t
((and ruby-ts--parenless-call-arguments-indent-p (parent-is "argument_list"))
| 42
| end")))
+
+(ert-deftest ruby-ts-indent-call-no-args ()
+ (skip-unless (treesit-ready-p 'ruby t))
+ (ruby-ts-with-temp-buffer
+ "variable = foo(
+
+)"
+ (goto-char (point-min))
+ (forward-line 1)
+ (funcall indent-line-function)
+ (should (= (current-indentation) ruby-indent-level))))
+
(ert-deftest ruby-ts-add-log-current-method-examples ()
(skip-unless (treesit-ready-p 'ruby t))
(let ((pairs '(("foo" . "#foo")