-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
PR: Add position to runcell #98
Conversation
I'm a bit -1 about this because it makes no sense trying to run cells outside Spyder and in a different session. Cells are only a help for exploratory coding, nothing else. @bcolsen, what do you think about this one? |
My use case would mainly be to be able to repeat the previous cell with up + enter. |
And also if I just executed a cell, there is no way for me to know which one. |
Also, that would give the option to run another cell from the console without having to click on the editor with the mouse. For example if I am looking at the code and want to run the cell at line 45. |
To start with, if you haven't already, please read through spyder-ide/spyder#7113 to understand process that got us to the current runcell implementation. There it is mentioned that currently we can't have the qtconsole run commands in spyder without implementing the jupyter custom messaging api. This would be the best answer to this problem but it is quite difficult. In this current solution you are relying on a saved file, which won't have the most up to date changes made to the file if the user hasn't saved. In fact since the runcell shortcut doesn't save the current file this solution won't necessarily even repeat the same code that was run with the last runcell shortcut. Even if the runcell shortcut saved the file running the runcell function in the console can't save the file in the editor. This is also a problem with the runfile function. A user might think that this function would save and run the file in the editor, but it doesn't. I'm also -1 here.
This is my one documented regression with the runcell function. To be clear though, up + enter didn't work that well with the previous version. It would only rerun the same code that was copied in last time. Having runcell repeat the last command was one option that was discussed but it would be ultimately more confusing for the users since they would think it was running the current version of the cell from there open code and not a version from last tie they press ctrl + enter
This is why the runcell function shows the cell name, but I can see that some people don't name their cells, so it's not a bad idea to add the line number into runcell for history purposes, but since line numbers in file can easily change users would be better off giving their cells meaningful unique names.
It would be cumbersome to type out the file name and as previously mentioned the line numbers would only match it the file was saved. The hot keys to go from the editor to the console are quite handy in this situation. |
I understand now why this is a bad solution. Maybe if the cell is unnamed, the title could be: "Unnamed cell @ line 37"? |
Title changed here: spyder-ide/spyder#9014 |
So by naming cells this is not necessary anymore, right? |
It solves the history problem, but not the up + enter problem, but I can see now that this PR is not the correct approach for this problem. |
Ok, thanks. |
fixes #97