pry-byebug icon indicating copy to clipboard operation
pry-byebug copied to clipboard

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

Open glindsey opened this issue 5 years ago • 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!

glindsey avatar Mar 13 '19 13:03 glindsey

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

deivid-rodriguez avatar Mar 13 '19 14:03 deivid-rodriguez

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

vsppedro avatar Jul 11 '20 04:07 vsppedro

Sure, that'd be awesome.

deivid-rodriguez avatar Jul 11 '20 06:07 deivid-rodriguez

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?

vsppedro avatar Aug 20 '20 23:08 vsppedro