Here's a simple way to replicate the issue: ~~~~ruby def foo # this will not auto-close end def bar # this comment has the word end in it # this will not auto-close end def baz # this WILL auto-close end ~~~~