julia-snail icon indicating copy to clipboard operation
julia-snail copied to clipboard

Can you access the result of evaluation in the REPL?

Open danielmatz opened this issue 1 year ago • 3 comments

After I call julia-snail-send-dwim, I sometimes want to play around with the resulting object in the REPL. It seems like that currently isn't possible. Is that right?

Is that something that could be added? Conceptually, it's a bit like the ans variable. I suppose one option is actually to bind ans to the result of the last evaluation. Or maybe there's a special JuliaSnail.result global that gets updated on each evaluation?

danielmatz avatar Jul 12 '24 16:07 danielmatz

I think it’s as simple as adding Base.MainInclude.ans = result to eval_tmpfile after line 261 (right before if isnothing(popup_params)). It seems to work for me, but I have not thoroughly tested it, nor am I certain that it doesn’t have bad side effects. Could you try making the change and drive it for a little while, and see if it seems safe to push to the main branch?

gcv avatar Jul 13 '24 06:07 gcv

Feel free to open a PR if there’s a better way to implement this feature.

gcv avatar Jul 13 '24 06:07 gcv

Wow, it really was that easy to do! I'll give it a try for a while and report back. Thanks!

danielmatz avatar Jul 13 '24 17:07 danielmatz