nixme / pry-nav

Binding navigation commands for Pry to make a simple debugger
MIT License
390 stars 35 forks source link

check_file_context broken when path has parenthesis #23

Closed eboswort closed 3 years ago

eboswort commented 10 years ago

I've been having issues running pry-nav commands. When I try to do so I see "Error: Cannot find local context. Did you use binding.pry?" errors.

In debugging the issue I noticed in pry_ext.rb, start_with_pry_nav is calling start_without_pry_nav due to PryNav.check_file_context(target) returning false.

I'm pretty sure I tracked down the issue, which is that I'm working inside a folder at a path that looks like this: "/Users/eli/Dropbox (Personal)/some_project/some_file.rb"

It looks like the regex in check_file_context is matching the parenthesis in the middle of that path.

If I move my project to "/Users/eli/Desktop/some_project", then everything works as expected.

I think the fix is to add a '^' and a '$' to the regex. Something like this: file == Pry.evalpath || (file !~ /^((.))$|^<._>$/ && file != '' && file != '-e')

I would have done a pull request but I don't completely understand the intentions of check_file_context so I'm hoping someone closer to the project could let me know if this suggestion makes sense.

Thanks, Eli

iloveitaly commented 3 years ago

This issue is very old, and I've never run into this. Closing this out.