ruby-block icon indicating copy to clipboard operation
ruby-block copied to clipboard

Block mismatch when assigned

Open gerrywastaken opened this issue 9 years ago • 2 comments

def foo()
  bar = if true
  end # highlighting this `end` shows a match on the method `def` line
end

It seems that doing an assignment from some blocks results in it not being spotted as the beginning of a block. In the above example I get def foo() as my match for the end for the if block.

edit: Thanks for making this awesome plugin!

gerrywastaken avatar Aug 20 '16 07:08 gerrywastaken

begin/end block with assignment not detected but do/end block with assignment is

# test for block
class RubyBlock
  def begin_end_block
    # this block is NOT detected due to assignment
    result = begin
      # empty
    end
    puts result
  end

  def do_end_block
    # this block is detected despite assignment
    result = [].each do
      # empty
    end
    puts result
  end
end
do-end assignment begin-end assignment begin-end no-assignment
do-end-assignment-okay begin-end-assignment-broken begin-end-no-assigment-okay

vyncem avatar Oct 13 '17 16:10 vyncem

+1

dalexj avatar Sep 28 '18 17:09 dalexj