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

Retain selected kernel in untitled notebook when saving notebook #151158

Closed
joyceerhl opened this issue Jun 2, 2022 · 8 comments · Fixed by #152280
Closed

Retain selected kernel in untitled notebook when saving notebook #151158

joyceerhl opened this issue Jun 2, 2022 · 8 comments · Fixed by #152280
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders notebook-kernel verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@joyceerhl
Copy link
Contributor

Testing microsoft/vscode-jupyter#10183

  1. Create untitled ipynb
  2. Run cells
  3. ✅ export commands are available in command palette
  4. Save the untitled notebook as ipynb and give it a title
  5. Open command palette
  6. 🐛 all the export commands are now hidden
@joyceerhl
Copy link
Contributor Author

I think this is because technically the cells were run in the context of the previous notebook, so I now need to run them again after saving the notebook, which is a rather nasty limitation...

@rebornix
Copy link
Member

rebornix commented Jun 2, 2022

I think this is because after saving we don't have a kernel connected to the newly saved notebook. There is no kernel session transfer (from untitled to saved notebook) currently.

@rebornix rebornix added the bug Issue identified by VS Code Team member as probable bug label Jun 2, 2022
@rebornix rebornix assigned DonJayamanne and unassigned rebornix Jun 2, 2022
@greazer greazer transferred this issue from microsoft/vscode-jupyter Jun 2, 2022
@greazer
Copy link
Contributor

greazer commented Jun 2, 2022

Save As is handled by core. Need to transfer current controller to new ipynb.

@Tyriar
Copy link
Member

Tyriar commented Jun 13, 2022

Seems related to #150890?

@roblourens roblourens added this to the June 2022 milestone Jun 13, 2022
@roblourens roblourens added feature-request Request for new features or functionality notebook-kernel and removed bug Issue identified by VS Code Team member as probable bug labels Jun 13, 2022
@roblourens
Copy link
Member

Not sure @Tyriar - we are handling this the same way we persist selection and other view state. But the editor still gets reopened with a new model. Dunno how this concept works in custom editors.

@Tyriar
Copy link
Member

Tyriar commented Jun 15, 2022

Custom editors have one the untitled editor closed and a new one with another URI open, I want a signal that a custom editor can handle to upgrade it so no close/open needs to happen

roblourens added a commit that referenced this issue Jun 16, 2022
Fixes #151158
Also fix cachine the previously selected kernel for Untitled-1 after saving it
roblourens added a commit that referenced this issue Jun 21, 2022
Fixes #151158
Also fix cachine the previously selected kernel for Untitled-1 after saving it
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jun 21, 2022
@roblourens
Copy link
Member

Steps:

  • Open an untitled jupyter notebook
  • Select a kernel
  • Save the notebook
  • The same kernel should be selected

The "Set kernel as default" gear icon in the kernel picker was also removed.

@jrieken jrieken added the verified Verification succeeded label Jun 28, 2022
@jrieken
Copy link
Member

jrieken commented Jun 28, 2022

Verified with this "kernel"

const ctrl = vscode.notebooks.createNotebookController('fff', 'jupyter-notebook', 'FOO');
	ctrl.executeHandler = (cells) => {
		for (let cell of cells) {
			const exec = ctrl.createNotebookCellExecution(cell)
			exec.start()
			exec.replaceOutput(new vscode.NotebookCellOutput([vscode.NotebookCellOutputItem.text(`hello@${Math.random()}`)]))
			exec.end(true)
		}
	}

@roblourens roblourens changed the title All export commands hidden from command palette after saving new untitled ipynb to virtual GitHub Repositories workspace Retain selected kernel in untitled notebook when saving notebook Jun 30, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders notebook-kernel verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants