Change:
Testing microsoft/vscode-jupyter untitled ipynb cells export commands are available in command palette the untitled notebook as ipynb and give it a title command palette :bug: all the export commands are now hidden
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...
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.
Save As is handled by core. Need to transfer current controller to new ipynb.
Seems related to
Not sure - 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.
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
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.
Verified with this "kernel"

Discussion:
focus?: number; editorFocused?: boolean; contributionsState?: { [id: string]: unknown }; <ins> selectedKernelId?: string; </ins> } export interface ICellModelDecorations {

this.restoreListViewState(viewState); } <ins> this._restoreSelectedKernel(viewState); </ins> // load preloads for matching kernel this._loadKernelPreloads();

} } <ins> private _restoreSelectedKernel(viewState: INotebookEditorViewState | undefined): void { if (viewState?.selectedKernelId && this.textModel) { const kernel = this.notebookKernelService.getMatchingKernel(this.textModel).all.find(k => k.id === viewState.selectedKernelId); if (kernel) { this.notebookKernelService.selectKernelForNotebook(kernel, this.textModel); } } } </ins> getEditorViewState(): INotebookEditorViewState { const state = this.viewModel?.getEditorViewState(); if (!state) {

contributionsState[id] = contribution.saveViewState(); } } state.contributionsState = contributionsState; <ins> state.selectedKernelId = this.activeKernel?.id; </ins> return state; }

this._register(_notebookService.onWillRemoveNotebookDocument(notebook => { const kernelId = this._notebookBindings.get(NotebookTextModelLikeId.str(notebook)); if (kernelId) { <del> this._onDidChangeNotebookKernelBinding.fire({ notebook: notebook.uri, oldKernel: kernelId, newKernel: undefined }); </del> <ins> this.selectKernelForNotebook(undefined, notebook); </ins> } })); this._sourceMenu = this._register(this._menuService.createMenu(MenuId.NotebookKernelSource, contextKeyService));

// a notebook has one kernel, a kernel has N notebooks // notebook <-1----N-> kernel <del> selectKernelForNotebook(kernel: INotebookKernel, notebook: INotebookTextModelLike): void { </del> <ins> selectKernelForNotebook(kernel: INotebookKernel | undefined, notebook: INotebookTextModelLike): void { </ins> const key = NotebookTextModelLikeId.str(notebook); const oldKernel = this._notebookBindings.get(key); if (oldKernel !== kernel?.id) {

} else { this._notebookBindings.delete(key); } <del> this._onDidChangeNotebookKernelBinding.fire({ notebook: notebook.uri, oldKernel, newKernel: kernel.id }); </del> <ins> this._onDidChangeNotebookKernelBinding.fire({ notebook: notebook.uri, oldKernel, newKernel: kernel?.id }); </ins> this._persistMementos(); } }