diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 6c64676d..5b662631 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -51,4 +51,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 + uses: actions/deploy-pages@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d3daa58..273d4003 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [6.1.1] - 2023-03-21 + +### Changed + +- Fixed a bug where the call chain formatter was incorrectly looking at call messages. + ## [6.1.0] - 2023-03-20 ### Added diff --git a/Gemfile.lock b/Gemfile.lock index f69c40d1..ad2aeaa5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - syntax_tree (6.1.0) + syntax_tree (6.1.1) prettier_print (>= 1.2.0) GEM diff --git a/lib/syntax_tree/node.rb b/lib/syntax_tree/node.rb index 3f013b31..54d132e6 100644 --- a/lib/syntax_tree/node.rb +++ b/lib/syntax_tree/node.rb @@ -2824,7 +2824,7 @@ def format_chain(q, children) if (receiver = child.receiver).is_a?(CallNode) && (receiver.message != :call) && (receiver.message.value == "where") && - (message.value == "not") + (child.message != :call && child.message.value == "not") # This is very specialized behavior wherein we group # .where.not calls together because it looks better. For more # information, see @@ -2848,8 +2848,8 @@ def format_chain(q, children) # If the parent call node has a comment on the message then we need # to print the operator trailing in order to keep it working. last_child = children.last - if last_child.is_a?(CallNode) && last_child.message.comments.any? && - last_child.operator + if last_child.is_a?(CallNode) && last_child.message != :call && + last_child.message.comments.any? && last_child.operator q.format(CallOperatorFormatter.new(last_child.operator)) skip_operator = true else diff --git a/lib/syntax_tree/version.rb b/lib/syntax_tree/version.rb index 3ed889e4..ad87d3e1 100644 --- a/lib/syntax_tree/version.rb +++ b/lib/syntax_tree/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SyntaxTree - VERSION = "6.1.0" + VERSION = "6.1.1" end diff --git a/test/fixtures/call.rb b/test/fixtures/call.rb index d35c6036..eec717f0 100644 --- a/test/fixtures/call.rb +++ b/test/fixtures/call.rb @@ -65,3 +65,10 @@ =begin =end to_s +% +fooooooooooooooooooooooooooooooooooo.barrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.where.not(:id).order(:id) +- +fooooooooooooooooooooooooooooooooooo + .barrrrrrrrrrrrrrrrrrrrrrrrrrrrrr + .where.not(:id) + .order(:id)