-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: jump to numbered stackframe with hotkey #19680
Conversation
@@ -567,14 +567,21 @@ function show_trace_entry(io, frame, n; prefix = " in ") | |||
n > 1 && print(io, " (repeats ", n, " times)") | |||
end | |||
|
|||
# Contains file name and file number. Gets set when a backtrace | |||
# is showed. Used by the REPL to make it possible to open |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shown
linfos = Base.LAST_BACKTRACE_LINE_INFOS | ||
str = String(take!(LineEdit.buffer(s))) | ||
n = tryparse(Int, str) | ||
isnull(n) && @goto writeback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These @goto
shenanigans are probably not worth it. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it. This sort of interactive input use case is actually one of the places where goto seems to actually be clearer and easier than anything else.
8179cec
to
eec37b6
Compare
Added some news. Note that it is currently possible to jump to REPL frames. This could be done by saving all the inputs in the REPL and than possibly creating a temp file that gets opened in the editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sold on the UI of this but it's certainly better than nothing, which is what we have now, so I'm all for trying it out and seeing how it goes.
linfos = Base.LAST_BACKTRACE_LINE_INFOS | ||
str = String(take!(LineEdit.buffer(s))) | ||
n = tryparse(Int, str) | ||
isnull(n) && @goto writeback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it. This sort of interactive input use case is actually one of the places where goto seems to actually be clearer and easier than anything else.
@@ -83,6 +83,8 @@ Library improvements | |||
|
|||
* The `chop` and `chomp` functions now return a `SubString` ([#18339]). | |||
|
|||
* Numbered stackframes printed in stacktraces can be opened in an editor by entering the corresponding number in the REPL and pressing `^Q`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add PR reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh now i got a merge conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't have to run news-update right away as long as the reference is in the right format for it
@tkelman, shall we merge this? |
with a squash and taking the |
This PR allows you to jump to a stackframe by entering its number (showed in the stacktrace from pr #19569) in the REPL and then pressing CTRL+Q. The keybinding is just something I took, it can be discussed.
I did a small recording of how it plays out: https://asciinema.org/a/17k6tfwec6hm6q57nzlbns61g