Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

[BUG] Can not step into subsequent calls on the same line of code (only the call which is evaluated first by Ruby) #75

Open
bjeanes opened this issue Oct 16, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bjeanes
Copy link

bjeanes commented Oct 16, 2020

Describe the bug

Given code such as:

foo(bar.to_h)

it is not apparently possible to step into the foo call. When Jard stops on this line, Step will step into the #to_h call. Unlike something like byebug, Step Out does not take me back to the foo(bar.to_h) line but appears to step up/out past it or perhaps just steps over it (it's hard to tell).

To Reproduce

  1. Enter jard before a method call that contains arguments which need evaluation via a method call. For instance:
    image

  2. F7 will take you to the first evaluated method call (request.referrer or request, depending on whether request is a local var or a method)
    image
    image

  3. Shift+F7 will take you to line after the initial break point (or a frame higher, if the breakpoint was the last line.
    image

Expected behavior

There should be someway step into redirect_to (and any other calls on that break point). For instance, byebug (and pry-byebug) you could do step, up, step, up, step and you would be inside redirect_to. It's clumsy, but it works.

Ideally, jard would underline the call which it would next step into, but admittedly that may be impossible to do reliably. However, it would look something like:

redirect_to(r͟e͟q͟u͟e͟s͟t͟.referrer || request.fullpath)
redirect_to(request.r͟e͟f͟e͟r͟r͟e͟r͟ || request.fullpath)
redirect_to(request.referrer || r͟e͟q͟u͟e͟s͟t͟.fullpath) # in the case where `request.referrer` is `nil`
redirect_to(request.referrer || request.f͟u͟l͟l͟p͟a͟t͟h͟) # in the case where `request.referrer` is `nil`
r͟e͟d͟i͟r͟e͟c͟t͟_͟t͟o͟(request.referrer || request.fullpath)

I am pretty confident this is not possible without some pretty advanced static analysis, but it does at least illustrate the steps that are expected to be able to be taken manually.

Screenshots

(inline in reproduction steps)

Environment (please complete the following information):

  • OS: ArchLinux
  • Terminal Emulator: GNOME Terminal
  • Output when you run tput colors in your terminal: 256
  • Output when you run echo $TERM in your terminal: xterm-256color
  • Output when you run stty:
    speed 38400 baud; line = 0;
    -brkint -imaxbel iutf8
    
  • Do you use tmux/screen or similar tty multiplexer? no
@bjeanes bjeanes added the bug Something isn't working label Oct 16, 2020
@bjeanes bjeanes changed the title [BUG] [BUG] Can not step into subsequent calls on the same line of code (only the call which is evaluated first by Ruby) Oct 16, 2020
@0x2c7 0x2c7 self-assigned this Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants