Has trouble selecting rspec blocks #10

bitmage opened this Issue Dec 5, 2011 · 1 comment


None yet

2 participants

bitmage commented Dec 5, 2011

I'm noticing the plugin has trouble selecting rspec blocks. Take this for example:

describe 'Web Service' do
    it 'should respond to GET' do
        GET '/'

For selecting the 'it' block, if I place my cursor at the end of the 'do' the selection works, but if I'm at the beginning of 'it' then it selects the surrounding describe block.

Assuming you're using regex to parse the block delimeters, I'm thinking something like /.*do$/

This would also work for methods in ruby that expect a block, which is a pretty common idiom.

nelstrom commented Dec 9, 2011

It feels as though the it 'should respond to GET' line is part of the block, but it's not. The block only begins with the do keyword. If you consider the do keyword as opening parenthesis, and the end keyword as closing parenthesis, then the behaviour of vir is correct.

Since the do keyword is the last word on the line, you can jump to it with $. So burn this into your finger-memory:


p.s. I think there's a missing do at the end of the first line of code in your example.

@nelstrom nelstrom closed this Dec 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment