ruby-ts-mode: Obey the option ruby-after-operator-indent
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--after-op-indent-p): New function. (ruby-ts--indent-rules): Use it. * test/lisp/progmodes/ruby-ts-mode-tests.el: Run indent test for ruby-after-operator-indent.rb. * test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb: Make sure indentation vars are at their default values.
This commit is contained in:
parent
300ca6ac37
commit
045404d1aa
3 changed files with 12 additions and 1 deletions
|
@ -685,6 +685,10 @@ a statement container is a node that matches
|
|||
;; Old... probably too simple
|
||||
((parent-is "block_parameters") first-sibling 1)
|
||||
|
||||
((and (not ruby-ts--after-op-indent-p)
|
||||
(parent-is "binary\\|conditional"))
|
||||
(ruby-ts--bol ruby-ts--statement-ancestor) ruby-indent-level)
|
||||
|
||||
((parent-is "binary")
|
||||
ruby-ts--binary-indent-anchor 0)
|
||||
|
||||
|
@ -790,6 +794,9 @@ a statement container is a node that matches
|
|||
(forward-char ruby-indent-level))
|
||||
(point)))
|
||||
|
||||
(defun ruby-ts--after-op-indent-p (&rest _)
|
||||
ruby-after-operator-indent)
|
||||
|
||||
(defun ruby-ts--class-or-module-p (node)
|
||||
"Predicate if NODE is a class or module."
|
||||
(string-match-p ruby-ts--class-or-module-regex (treesit-node-type node)))
|
||||
|
|
|
@ -56,4 +56,7 @@
|
|||
|
||||
# Local Variables:
|
||||
# mode: ruby-ts
|
||||
# ruby-after-operator-indent: t
|
||||
# ruby-block-indent: t
|
||||
# ruby-method-params-indent: t
|
||||
# End:
|
||||
|
|
|
@ -251,8 +251,9 @@ The whitespace before and including \"|\" on each line is removed."
|
|||
(kill-buffer buf)))))
|
||||
|
||||
(ruby-ts-deftest-indent "ruby-ts.rb")
|
||||
(ruby-ts-deftest-indent "ruby-method-params-indent.rb")
|
||||
(ruby-ts-deftest-indent "ruby-after-operator-indent.rb")
|
||||
(ruby-ts-deftest-indent "ruby-block-indent.rb")
|
||||
(ruby-ts-deftest-indent "ruby-method-params-indent.rb")
|
||||
|
||||
(provide 'ruby-ts-mode-tests)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue