Execution status and time info on buffer status bar#9
Conversation
…ning and the execution duration
There was a problem hiding this comment.
why remove this? Note that decoding already is default in python3, so this ensures consistent behaviour also in python2.
There was a problem hiding this comment.
This got in by mistake and i thought i had deleted it.
|
Rather than changing the buffer name, which is kinda a hack and not flexible, it is better to expose variables (and callbacks if needed) to let the info be shown e.g. in titlestring or statusline, per users configuration. There already is |
There was a problem hiding this comment.
can't this be done by using %time ( or corresponding macro in other lang) ?
There was a problem hiding this comment.
I think that it should be possible to have execution time in there. Specifically in a REPL setting would allow to quickly find identify the hotspots in the code by running code line by line without having to modify the code. But maybe all that is needed is to be able to "decorate" each call to the kernel and display the output somewhere. This way it would be possible to wrap each command with code to compute a timedelta.
There was a problem hiding this comment.
using kernel-side %time is more reliable, because if one enqueues several commands (i e sends more requests before the last one is done) the timing will still be correct
But maybe all that is needed is to be able to "decorate" each call to the kernel and display the output somewhere.
That should be possible with something like
nnoremap <Leader>t :call IPyRun('%time '.getline('.'))<cr>
There was a problem hiding this comment.
I agree that it is pretty easy once you come up with the idea. It this also works nicely for visual mode:
let g:ipy_vprefix = "%%time \n"
vnoremap <Plug>(IPy-Run) :<c-u>call IPyRun(g:ipy_vprefix . <SID>get_visual_selection())<cr>
I think I'd be nice to have such a feature out-of-the-box, as not everybody using the plugin should come up with their own a solution. The problem with this solution is that it is python specific.
using kernel-side %time is more reliable, because if one enqueues several commands (i e >sends more requests before the last one is done) the timing will still be correct
Good point. The only reason to do it on the client side is that it would work for all kernels and the output could be put anywhere (e.g. airline), avoiding the pollution of the output buffer. If the user is interested in the timing she should not enqueue commands.
|
I agree it is not a clean solution, and probably the buffer name is not the right place to put the information. Regarding the positioning, i think the natural place for the status is the buffer, not the terminal window name, although having it in the title does allow me to know do some other work while the code is running. |
|
True, that was an example, |
It was annoying me that there was apparently no visual indication as to whether a command is executing.
Similar to Jupyter Notebooks, i added a [*] to the buffer name when it is executed, together with the time when the command was sent. It also displays the elapsed time when the command is finished.