1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-26 07:11:34 -08:00

ruby-ts-mode: Fix the rules for hanging arrays and hashes

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Fix the rules for hanging arrays and hashes (to line up to
parent-bol instead of the opening brace).

* test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb:
New file with examples.

* test/lisp/progmodes/ruby-ts-mode-tests.el: Use it here.
This commit is contained in:
Dmitry Gutov 2023-01-17 23:46:41 +02:00
parent c4f0b6ccea
commit 9ed9ff4690
3 changed files with 28 additions and 14 deletions

View file

@ -749,20 +749,10 @@ i.e. expr of def foo(args) = expr is returned."
(not ruby-ts--same-line-hash-array-p))
grand-parent ruby-indent-level)
((n-p-gp "}" "hash" "assignment") (ruby-ts--bol ruby-ts--grand-parent-node) 0)
((n-p-gp nil "hash" "assignment") (ruby-ts--bol ruby-ts--grand-parent-node) ruby-indent-level)
((n-p-gp "]" "array" "assignment") (ruby-ts--bol ruby-ts--grand-parent-node) 0)
((n-p-gp nil "array" "assignment") (ruby-ts--bol ruby-ts--grand-parent-node) ruby-indent-level)
((n-p-gp "}" "hash" "argument_list") first-sibling 0)
((n-p-gp nil "hash" "argument_list") first-sibling ruby-indent-level)
((n-p-gp "]" "array" "argument_list") first-sibling 0)
((n-p-gp nil "array" "argument_list") first-sibling ruby-indent-level)
((match "}" "hash") first-sibling 0)
((parent-is "hash") first-sibling ruby-indent-level)
((match "]" "array") first-sibling 0)
((parent-is "array") first-sibling ruby-indent-level)
((match "}" "hash") parent-bol 0)
((parent-is "hash") parent-bol ruby-indent-level)
((match "]" "array") parent-bol 0)
((parent-is "array") parent-bol ruby-indent-level)
;; If the previous method isn't finished yet, this will get
;; the next method indented properly.