def feel_for_enclosing_parens(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
      range = node.source_range
      original_source = source_from_range(range)
      left_offset = -1
      right_offset = 0

      if original_source[-1] != ')'
        right_offset += 1 while character_at(range.end_pos, right_offset) =~ /\s/

        return original_source if character_at(range.end_pos, right_offset) != ')'
      end

      # At this point, we know that we're wrapped on the right by a ')'.
      # Are we wrapped on the left by a '('?
      left_offset -= 1 while character_at(range.start_pos, left_offset) =~ /\s/
      return original_source if character_at(range.start_pos, left_offset) != '('

      # At this point, we know we're wrapped on both sides by parens. However,
      # those parens may be part of a parent function call. We don't care about
      # such parens. This depends on whether the preceding character is part of
      # a function name.
      return original_source if character_at(range.start_pos, left_offset - 1).match?(/[A-Za-z0-9_]/)

      range.start_pos.offset += left_offset
      range.end_pos.offset += right_offset
      source_from_range(range)
    end
def feel_for_enclosing_parens(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
      range = node.source_range
      original_source = source_from_range(range)
      left_offset = -1
      right_offset = 0

      if original_source[-1] != ')'
        right_offset += 1 while character_at(range.end_pos, right_offset) =~ /\s/

        return original_source if character_at(range.end_pos, right_offset) != ')'
      end

      # At this point, we know that we're wrapped on the right by a ')'.
      # Are we wrapped on the left by a '('?
      left_offset -= 1 while character_at(range.start_pos, left_offset) =~ /\s/
      return original_source if character_at(range.start_pos, left_offset) != '('

      # At this point, we know we're wrapped on both sides by parens. However,
      # those parens may be part of a parent function call. We don't care about
      # such parens. This depends on whether the preceding character is part of
      # a function name.
      return original_source if character_at(range.start_pos, left_offset - 1).match?(/[A-Za-z0-9_]/)

      range.start_pos.offset += left_offset
      range.end_pos.offset += right_offset
      source_from_range(range)
    end
An expression enclosed in parens will include or not include each paren, depending
 on whitespace. Here we feel out for enclosing parens, and return them as the new
 source for the node.