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

PR: Add position to runcell #98

Closed
wants to merge 4 commits into from

Conversation

impact27
Copy link
Contributor

fixes #97

@ccordoba12 ccordoba12 changed the title add position to runcell PR: Add position to runcell Mar 23, 2019
@ccordoba12
Copy link
Member

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?

@impact27
Copy link
Contributor Author

My use case would mainly be to be able to repeat the previous cell with up + enter.
I just feel that it is strange to have a function executed in the console, and added to the history, with hidden arguments, which means that you can’t execute it again.

@impact27
Copy link
Contributor Author

And also if I just executed a cell, there is no way for me to know which one.

@impact27
Copy link
Contributor Author

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.

@bcolsen
Copy link
Member

bcolsen commented Mar 24, 2019

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.

My use case would mainly be to be able to repeat the previous cell with up + enter.
I just feel that it is strange to have a function executed in the console, and added to the history, with hidden arguments, which means that you can’t execute it again.

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

And also if I just executed a cell, there is no way for me to know which one.

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.

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.

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.

@impact27
Copy link
Contributor Author

I understand now why this is a bad solution. Maybe if the cell is unnamed, the title could be: "Unnamed cell @ line 37"?

@impact27 impact27 closed this Mar 29, 2019
@impact27
Copy link
Contributor Author

Title changed here: spyder-ide/spyder#9014

@ccordoba12
Copy link
Member

So by naming cells this is not necessary anymore, right?

@impact27
Copy link
Contributor Author

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.

@ccordoba12
Copy link
Member

Ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't repeat runcell from terminal
3 participants