deivid-rodriguez/pry-byebug

Feature Request: "next"-style command that runs until the next non-gem line

Opened this issue · 4 comments

My apologies if this has been suggested before, but I think it would be super useful to have a command that lets you run until you hit the next line of non-Rails/non-gem code.

Here's an example scenario: I'd like to use contracts.ruby to enforce calling contracts on methods. The problem I run into is that if I want to use pry-byebug to step into a method call, it ends up stepping into contracts code first. Although a workaround is possible via combinations of step, up and next, it's very easily to screw that up and end up accidentally stepping right over the method call. A single command that would run until hitting code that isn't inside a gem would be way more convenient.

If I have the time at some point, I'll see if I can delve into this myself and maybe get a PR up for it, but in the meantime I wanted to mention it. Thanks a lot!

Yes. This has been requested in byebug but I never found the time to look into it. See deivid-rodriguez/byebug#47.

Hi, @deivid-rodriguez, I would like to work on this if you don't mind.

Sure, that'd be awesome.

Sorry for taking so long to ask, but what do you have in mind about what this feature should look like?

I was thinking about something like:

next --filter folder

With the possibility to pass more than one like:

next --filter models controllers

Or maybe the whole project:

next --filter .

Finally the ~/.pryrc would be able to have this configuration, for example:

if defined?(PryByebug)
  Pry.commands.alias_command 'c', 'continue'
  Pry.commands.alias_command 's', 'step --filter .'
  Pry.commands.alias_command 'n', 'next --filter .'
  Pry.commands.alias_command 'f', 'finish'
end

What do you think?