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

Feature Request: "Run All" and "Restart Kernel and Run All" for Editor/Console #5579

WhoIsJack opened this issue Nov 2, 2018 · 1 comment · Fixed by #5641

Feature Request: "Run All" and "Restart Kernel and Run All" for Editor/Console #5579

WhoIsJack opened this issue Nov 2, 2018 · 1 comment · Fixed by #5641


Copy link

@WhoIsJack WhoIsJack commented Nov 2, 2018

When working with a .py file (or some other language file) in the editor and an associated console (opened through right click > "Create Console for Editor"), code can be run by selecting the desired lines and hitting Shift+Enter.

However, sometimes one needs to run everything or - perhaps more importantly - wipe the console's state and run everything. Currently, doing the latter would require starting a new console (and closing the old one), selecting everything (Ctrl+a) and then hitting Shift+Enter (unless I'm missing something?). In particular the first step in this sequence makes this kind of cumbersome.

I think it would be nice if "Run All" and "Restart Kernel and Run All" in the Run menu were supported to handle these cases. Potentially, "Restart Kernel and Run All" could be relabeled as "Restart Console and Run All" when working in an editor. Finally, it could be cool to use something like Ctrl+Shift+Enter as a keyboard shortcut to trigger "Restart Console and Run All".

@jasongrout jasongrout added this to the Future milestone Nov 12, 2018
Copy link

@jasongrout jasongrout commented Nov 12, 2018

I think this would possibly be a good intermediate-level first issue. The code that adds the one run menu item is at

// Add a code runner to the Run menu.
noun: 'Code',
isEnabled: current => {
let found = false;
consoleTracker.forEach(console => {
if (console.console.session.path === current.context.path) {
found = true;
return found;
run: () => commands.execute(CommandIDs.runCode)
} as IRunMenu.ICodeRunner<IDocumentWidget<FileEditor>>);
Something similar to it could be added to support the run all and restart kernel and run all menu items. Related code in the notebook is at
runAll: current => {
const { context, content } = current;
return NotebookActions.runAll(content, context.session).then(
() => void 0
restartAndRunAll: current => {
const { context, content } = current;
return context.session.restart().then(restarted => {
if (restarted) {
NotebookActions.runAll(content, context.session);
return restarted;
} as IRunMenu.ICodeRunner<NotebookPanel>);
to see how to add those items to the menu.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants