Skip to content

Conversation

Yoyokrazy
Copy link
Contributor

Fixes #9242

Only thought is a different enablement, taking into account notebookEditorFocused and/or jupyter.hascodecells? On the other hand, commands like jupyter.runcurrentcell only require isWorkspaceTrusted to be used.

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for feature-requests.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).

@Yoyokrazy Yoyokrazy requested a review from rebornix April 17, 2023 20:46
@Yoyokrazy Yoyokrazy self-assigned this Apr 17, 2023
@DonJayamanne
Copy link
Contributor

Out of curiosity is there any reason why we cannot do something like this #9242 (comment)

@Yoyokrazy Yoyokrazy enabled auto-merge (squash) April 17, 2023 22:31
@Yoyokrazy Yoyokrazy disabled auto-merge April 17, 2023 22:31
@Yoyokrazy
Copy link
Contributor Author

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 runCommand. Ideally there would be a way to add a label, then it would probably be a more desirable solution. Talked with @rebornix and think that core commands that jupyter supports can be implemented as in this PR, and more custom sets of commands can be implemented via keybindings.json.

rebornix
rebornix previously approved these changes Apr 19, 2023
@@ -175,6 +187,20 @@ export class NotebookCommandListener implements IDataScienceCommandListener {
this.runAllCells();
}

private async restartKernelAndRunUpToSelectedCell(notebookUri: Uri | undefined) {
const activeNBE = this.notebookEditorProvider.activeNotebookEditor;
Copy link
Member

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.

Copy link
Contributor Author

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))"
Copy link
Contributor

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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@DonJayamanne it exists in Jupyter Lab.

@Yoyokrazy Yoyokrazy merged commit 5347e8c into main Apr 19, 2023
@Yoyokrazy Yoyokrazy deleted the milively/toSelected branch April 19, 2023 18:26
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.

Add "Restart and run all" command
3 participants