hmatsuda / ruby-block

highlight matching ruby block on Atom editor
https://atom.io/packages/ruby-block
GNU General Public License v2.0
16 stars 11 forks source link

Block mismatch when assigned #23

Open gerrywastaken opened 8 years ago

gerrywastaken commented 8 years ago
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!

vyncem commented 7 years ago

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
dalexj commented 6 years ago

+1