Git Product home page Git Product logo

Comments (7)

alesya-h avatar alesya-h commented on May 22, 2024 1

Could you make it configurable at least? This feature may be useful for those who use debugging features often, but there are lots of people who use pry just to eval code in a context. In our case one developer in a team needed debugging features, added pry-byebug to Gemfile, and now everyone else suffer from this behaviour. Thank you.

from pry-byebug.

deivid-rodriguez avatar deivid-rodriguez commented on May 22, 2024

Hi @rf- , I don't think it modifies the experience at all, it just changes a marker from one line to the next. It might surprise users, but once they enter a few commands and see everything works just like before, I don't see the problem. Plus, there's a bump in the major version number so that should be a "surprise reducer".

For people who want to use debugging features and step through the code, this commit saves them from having to enter a meaningless next everytime they start debugging.

I'm very positive about keeping this, but I'm open for a discussion. 👍

from pry-byebug.

rf- avatar rf- commented on May 22, 2024

This is actually worse than I realized. It's not just the visual marker, it's actually stepping out of the context where the user placed the breakpoint. Look at this example:

From: /home/rfitz/xxxxx/lib/tasks/db.rake @ line 27 :

    22:       sql_dump.gsub!(/(CREATE TABLE `\w+` \(\n)(.*)(^\))/m) do |match|
    23:         binding.pry
    24:       end
    25:
    26:       # Sort the schema_migrations inserts to reduce churn.
 => 27:       migration_sql = sql_dump.slice!(/INSERT INTO schema_migrations.*/m)
    28:       migrations = migration_sql.split("\n").select(&:present?)
    29:       sorted_migrations = migrations.sort.join("\n\n")
    30:
    31:       File.write(filename, sql_dump << sorted_migrations << "\n")
    32:     end

[1] pry(main)> match
NameError: undefined local variable or method `match' for main:Object
from (pry):1:in `block (3 levels) in <top (required)>'
[2] pry(main)>

This is breaking the most important feature of Pry, the ability to write binding.pry and drop into a REPL in the context where you placed the binding.pry statement. Please fix it.

from pry-byebug.

deivid-rodriguez avatar deivid-rodriguez commented on May 22, 2024

@rf- This was unintentional and it's a bug, thanks for finding out. I think I've fixed it in latest master. Could you please try?

from pry-byebug.

deivid-rodriguez avatar deivid-rodriguez commented on May 22, 2024

@rf- I'm going to close this for now. If you have further objections, feel free to reopen and continue the discussion.

from pry-byebug.

gerrywastaken avatar gerrywastaken commented on May 22, 2024

@deivid-rodriguez The fix improved things but the behaviour is still unexpected.

$ ruby breakpoint_test.rb                                                                                                                                                                                                                                                                               [2.1.2]

From: /tmp/breakpoint_test.rb @ line 6 :

    1: require 'pry'
    2: 
    3: begin
    4:   1/0
    5: rescue ZeroDivisionError
 => 6:   binding.pry # $! is ZeroDivisionError with a message of 'divided by 0'
    7: end
    8: 'huh?' # If this line didn't exist then the binding.pry acts like it wasn't called

2.1.2 (main):0 > $!
=> #<ZeroDivisionError: divided by 0>
2.1.2 (main):0 > exit
$ gem install pry-byebug                                                                                                                                                                                                                                                                     [2.1.2]
Fetching: pry-byebug-2.0.0.gem (100%)
Successfully installed pry-byebug-2.0.0
1 gem installed
$ ruby breakpoint_test.rb                                                                                                                                                                                                                                                                               [2.1.2]

From: /tmp/breakpoint_test.rb @ line 8 :

    3: begin
    4:   1/0
    5: rescue ZeroDivisionError
    6:   binding.pry # $! is ZeroDivisionError with a message of 'divided by 0'
    7: end
 => 8: 'huh?' # If this line didn't exist then the binding.pry acts like it wasn't called

2.1.2 (main):0 > $!
=> nil

from pry-byebug.

deivid-rodriguez avatar deivid-rodriguez commented on May 22, 2024

Read the linked issue, that's the current state of things.

from pry-byebug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.