* etc/NEWS: Describe it here.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--parent-call-or-bol):
Support the option ruby-bracketed-args-indent here too (bug#60321).
* test/lisp/progmodes/ruby-ts-mode-tests.el: Include
ruby-bracketed-args-indent.rb as test examples.
* test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb:
Extend examples for better regression testing.
(cherry picked from commit
24f12bdd77ee3dd1f2254bdc6cb5cbf7be488c36)
;; No paren/curly/brace found on the same line.
((< (treesit-node-start found) parent-bol)
parent-bol)
+ ;; Nesting of brackets args.
+ ((and
+ (not (eq ruby-bracketed-args-indent t))
+ (string-match-p "\\`array\\|hash\\'" (treesit-node-type parent))
+ (equal (treesit-node-parent parent) found)
+ ;; Grandparent is not a parenless call.
+ (or (not (equal (treesit-node-type found) "argument_list"))
+ (equal (treesit-node-type (treesit-node-child found 0))
+ "(")))
+ parent-bol)
;; Hash or array opener on the same line.
((string-match-p "\\`array\\|hash\\'" (treesit-node-type found))
(save-excursion
-update({
- key => value,
- other_key:
-}, {
- key => value,
- other_key:
-})
+foo
+ .update({
+ key => value,
+ other_key:
+ }, {
+ key => value,
+ other_key:
+ })
update([
1,
2
], arg2)
+def foo
+ foo.update(
+ {
+ key => value,
+ other_key: foo
+ }
+ )
+end
+
# Local Variables:
# ruby-bracketed-args-indent: nil
# End:
(ruby-ts-deftest-indent "ruby-method-call-indent.rb")
(ruby-ts-deftest-indent "ruby-method-params-indent.rb")
(ruby-ts-deftest-indent "ruby-parenless-call-arguments-indent.rb")
+(ruby-ts-deftest-indent "ruby-bracketed-args-indent.rb")
(provide 'ruby-ts-mode-tests)