Skip to content
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

Merged
merged 4 commits into from
Jan 4, 2017
Merged

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented Dec 22, 2016

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

@KristofferC KristofferC changed the title jump to numbered stackframe with hotkey RFC: jump to numbered stackframe with hotkey Dec 22, 2016
@@ -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
Copy link
Contributor

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
Copy link
Member Author

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. :)

Copy link
Member

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.

@KristofferC KristofferC changed the base branch from kc/error_msgs_2 to master December 30, 2016 15:58
@KristofferC KristofferC added the REPL Julia's REPL (Read Eval Print Loop) label Dec 30, 2016
@KristofferC
Copy link
Member Author

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.

Copy link
Member

@StefanKarpinski StefanKarpinski left a 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
Copy link
Member

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.

@StefanKarpinski StefanKarpinski added this to the 0.6.0 milestone Jan 2, 2017
@@ -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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add PR reference

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved it

Copy link
Contributor

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

@StefanKarpinski
Copy link
Member

@tkelman, shall we merge this?

@tkelman tkelman merged commit 8eb55ab into master Jan 4, 2017
@tkelman tkelman deleted the kc/editor_stackframes branch January 4, 2017 18:34
@tkelman
Copy link
Contributor

tkelman commented Jan 4, 2017

with a squash and taking the ci skips out of the commit messages, yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants