(ruby-ts--indent-rules): Indent inside empty parens properly
* 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.
This commit is contained in:
parent
7fb69ce233
commit
0d3b6518e3
2 changed files with 15 additions and 1 deletions
|
@ -680,7 +680,9 @@ a statement container is a node that matches
|
|||
((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"))
|
||||
|
|
|
@ -110,6 +110,18 @@ The whitespace before and including \"|\" on each line is removed."
|
|||
| 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")
|
||||
|
|
Loading…
Add table
Reference in a new issue