]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-ts-mode: Fix/change indentation of a continuation method call
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 17 Jan 2023 22:55:09 +0000 (00:55 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 18 Jan 2023 01:27:37 +0000 (03:27 +0200)
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules):
Fix/change indentation of a continuation method call.

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

lisp/progmodes/ruby-ts-mode.el
test/lisp/progmodes/ruby-mode-resources/ruby-ts.rb

index 853c869a319278a14b7ca4ffcf30eb5245ac02b0..cbf86544bed6d6498aa429dd751b56351a795d99 100644 (file)
@@ -697,9 +697,9 @@ i.e. expr of def foo(args) = expr is returned."
            ;; 2) With paren, 1st arg on next line
            ((and (query "(argument_list \"(\" _ @indent)")
                  (node-is ")"))
-            (ruby-ts--bol ruby-ts--grand-parent-node) 0)
+            parent-bol 0)
            ((query "(argument_list \"(\" _ @indent)")
-            (ruby-ts--bol ruby-ts--grand-parent-node) ruby-indent-level)
+            parent-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"))
             first-sibling 0)
index 7de94ceadec977b3e461a0d343a6ea4ab5ba298a..1a07ababc4609e830327a5019954d978fe611c07 100644 (file)
@@ -28,6 +28,19 @@ else
   dog = 99
 end
 
+foo1 =
+  subject.update(
+    1
+  )
+
+foo2 =
+  subject.
+    update(
+      # Might make sense to indent this to 'subject' instead; but this
+      # style seems more popular.
+      2
+    )
+
 # Local Variables:
 # mode: ruby-ts
 # End: