pry / pry-stack_explorer

Walk the stack in a Pry session
Other
454 stars 28 forks source link

Filter out non-app frames #23

Closed aeonaut closed 4 years ago

aeonaut commented 9 years ago

99 times out of 100 I just want to navigate around the frames that are actually in my app -- ignoring rails, pry, gem, and whatever other stuff is in-between. I imagine I'm not alone in this. Could pry-stack_explorer support this? A couple of ideas:

1) Let show-stack accept a block a la pry's caller, so that I can do something along the same lines:

 stack = caller.select { |line| line[app_name] } 

2) Let show-stack -v accept a filepath regex, filtering out all frames that don't match

3) Modify frame, up, and down so that the regex you supply to them matches the file name as well as the method name. It would be wicked cool to just keep hitting up /app_name/ (or equivalent) to walk up my stack.

4) Support BacktraceCleaner, suggested in issue #17. (Maybe this already works -- I haven't tried. It would be preferable not to have to use another gem to do this, however.)

Thoughts?

banister commented 9 years ago

@aeonaut thanks, it's been a long time since i worked on stack explorer but i'm about to revisit it soon as it has some problems with recent pry versions. I'll take some of your suggestions into account, and perhaps ping you if i need some help!

aeonaut commented 9 years ago

Sounds good, John -- I'm surely underqualified but will do my best to chip in if called upon. Thanks for an awesome gem!

On Thu Feb 05 2015 at 11:27:14 AM John Mair notifications@github.com wrote:

@aeonaut https://github.com/aeonaut thanks, it's been a long time since i worked on stack explorer but i'm about to revisit it soon as it has some problems with recent pry versions. I'll take some of your suggestions into account, and perhaps ping you if i need some help!

— Reply to this email directly or view it on GitHub https://github.com/pry/pry-stack_explorer/issues/23#issuecomment-73076261 .

skull-squadron commented 9 years ago

Running show-stack results in:

when_started hook failed: NoMethodError: private method `eval' called for nil:NilClass
XXX/lib/pry-stack-explorer.rb:109:in `bindings_equal?'
(see _pry_.hooks.errors to debug)

Uneducated guestimate: pry API changed slightly.

Update: This pry backward-compatible fix seems to work (.first might be an invalid assumption)

     def call(target, options, _pry_)
+      target ||= _pry_.binding_stack.first if _pry_ # to fix call(nil, {}, ...)
       options = {
         :call_stack    => true,
banister commented 9 years ago

@steakknife awesome research, thanks. Tomororw should be the day i finally work on this as i have a day off from work that i want to dedicate to fixing up this project!

joallard commented 4 years ago

This will be covered by #53 , without the regexes