-
Notifications
You must be signed in to change notification settings - Fork 338
Add support for Restart Kernel + Run up to Selected Cell
command
#13342
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
Conversation
Out of curiosity is there any reason why we cannot do something like this #9242 (comment) |
Primarily for ease of use and discoverability for the user. It seems like using a dual command as mentioned to bind them together would force the user to search for specifically the term |
@@ -175,6 +187,20 @@ export class NotebookCommandListener implements IDataScienceCommandListener { | |||
this.runAllCells(); | |||
} | |||
|
|||
private async restartKernelAndRunUpToSelectedCell(notebookUri: Uri | undefined) { | |||
const activeNBE = this.notebookEditorProvider.activeNotebookEditor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this.notebookEditorProvider.activeNotebookEditor
here? It's possible that restart happens on an inactive notebook editor but this check will block the restart from running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, then I'll shift to taking the uri as done on L#193 and then it should be covered either case. Just need to change the range on L#197
package.json
Outdated
"title": "%jupyter.command.jupyter.restartkernelandrunuptoselectedcell.title%", | ||
"shortTitle": "%jupyter.command.jupyter.restartkernelandrunuptoselectedcell.title%", | ||
"category": "Jupyter", | ||
"enablement": "isWorkspaceTrusted && (jupyter.interactive.canRestartNotebookKernel || (notebookKernel =~ /^ms-toolsai.jupyter\\// && jupyter.notebookeditor.canrestartNotebookkernel))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why are we adding this new command, i thought this was Restart and Run all
, this seems to be Restart and Run upto selected cell
Why do we need this new command, i didn't realize this new command was a requirement (also i do not think this is something that exists in Jupyter either, hence feels a little odd to add this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DonJayamanne it exists in Jupyter Lab.
Fixes #9242
Only thought is a different enablement, taking into account
notebookEditorFocused
and/orjupyter.hascodecells
? On the other hand, commands likejupyter.runcurrentcell
only requireisWorkspaceTrusted
to be used.package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).