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

Enable pry-like stop on binding.pry

Open stephenprater opened this issue 10 years ago • 7 comments
trafficstars

Given the discussion in Issue #45, this adds a configuration option to enable pry-like behavior on binding.pry.

I don't think this is either better or worse, exactly, but the "step 3" behavior does seem to break some popular pry plugins (like pry-rescue.)

I did some non-exhaustive poking around and it appears to fix that issue as well. It definitely fixes the described issue in #45 where the last line of the file can now be binding.pry

I've left the default behavior as :byebug - so people who want the :pry behavior can set it in their .pryrc files.

stephenprater avatar Sep 03 '15 08:09 stephenprater

The CI Fail is because of RuboCop - but it's not giving me any information - just "Hook raised unexpected error."

stephenprater avatar Sep 03 '15 09:09 stephenprater

Great analysis but unforunately, :cry: this doesn't work on my machine. It's critical to do the gem install before the test because uninstalling pry-byebug actually fixes the original reported issue.

Running ruby test/examples/last_line.rb didn't invoke pry. If you uninstall byebug, it will invoke.

I tried adding this to my .pryrc too.

PryByebug.binding_behavior = :pry

squarism avatar Sep 03 '15 17:09 squarism

Poop. Looks like .pryrc isn't loaded until the actual Pry repl is started. We start Byebug before we start pry, so we've either got to do the Pry.initial_session_setup ourselves, or we've got to hook later into the process. I put the setup call in the start method for now.

stephenprater avatar Sep 03 '15 18:09 stephenprater

Ok. Yeah, that works now @stephenprater. Awesome. :+1:

This is definitely required (as you know) to make pry invoke.

# ~/.pryrc
PryByebug.binding_behavior = :pry

I wonder if this would be the default if it's considered stable? @deivid-rodriguez

squarism avatar Sep 03 '15 18:09 squarism

Guys, I'll be off until mid october or so. I'll review and consider this when I'm back.

Salud!

deivid-rodriguez avatar Sep 03 '15 21:09 deivid-rodriguez

@deivid-rodriguez would you be able to take a look at this now? I'm running into https://github.com/ConradIrwin/pry-rescue/issues/71 and this would solve the problem for me. Thanks.

russelldavis avatar Sep 10 '16 03:09 russelldavis

@russelldavis No, sorry... I'll let you know when I get to it, but don't know when that'll be. In the mid time, you can use this branch if it works for you!

deivid-rodriguez avatar Sep 10 '16 03:09 deivid-rodriguez