From e74ba72a6a34221abf47145ecf0ec4fc8cda2555 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 22 Jan 2023 04:55:13 +0200 Subject: [PATCH] ruby-ts-mode: Fix two additional cases with ruby-method-call-indent=nil * lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules): Fix two additional cases with ruby-method-call-indent=nil. * test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb: Add examples. --- lisp/progmodes/ruby-ts-mode.el | 2 +- .../ruby-mode-resources/ruby-method-call-indent.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index ac0b5d7c6d4..7e5125453e8 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -665,7 +665,7 @@ a statement container is a node that matches (or (match "\\." "call") (query "(call \".\" (identifier) @indent)"))) - parent 0) + (ruby-ts--bol ruby-ts--statement-ancestor) ruby-indent-level) ((match "\\." "call") parent ruby-indent-level) ;; method parameters -- four styles: diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb b/test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb index 1a8285ee919..624a6caafe5 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby-method-call-indent.rb @@ -1,3 +1,8 @@ +foo = subject + .update( + 1 + ) + foo2 = subject. update( @@ -10,6 +15,10 @@ foo3 = 2 ) +my_array.select { |str| str.size > 5 } + .map { |str| str.downcase } + # Local Variables: # ruby-method-call-indent: nil +# ruby-align-chained-calls: nil # End: -- 2.39.2