Change:
create a notebook and save it. Run a cell with a kernel. Change the kernel and run another cell reopen the notebook as plain text and note the kernel spec in the metadata. metadata should specify the kernel that was most recently used, but it specifies the original. Seems to repro with both local and remote kernels
impacts microsoft/vscode-jupyter since we're not getting the correct suggestion
I think this is a regression. please could you verify this works as expected in stable.
yes, the kernelspec updates in stable as expected
This is actually a bug in the new metadata API. Transferring to vscode core.
This should've been assigned to since we are adamant in verifying each issue that gets shipped in a recovery release individually. I found this out by looking into . Please find someone to verify this issue in the latest release candidate build.
Oh my bad... this was released already in ... My mistake.
But there's still a recommendation: this should've been assigned to all along so people verify the issue was fixed. Can you find someone to verify and mark it as ?
I had actually verified back when it was fixed, just didn't add the label since it wasn't marked verification needed. I'll do that now tho
Thanks!

Discussion:
const editor = await vscode.window.showNotebookDocument(notebook); const notebookChangeEvent = asPromise<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument); <del> const version = editor.document.version; await editor.edit(editBuilder => { editBuilder.replaceCells(1, 0, [{ kind: vscode.NotebookCellKind.Code, languageId: 'javascript', value: 'test 2', outputs: [], metadata: undefined }]); editBuilder.replaceCellMetadata(0, { inputCollapsed: false }); }); </del> <ins> const version = editor.notebook.version; const edit = new vscode.WorkspaceEdit(); const cellEdit = vscode.NotebookEdit.replaceCells(new vscode.NotebookRange(1, 0), [{ kind: vscode.NotebookCellKind.Code, languageId: 'javascript', value: 'test 2', outputs: [], metadata: undefined }]); const metdataEdit = vscode.NotebookEdit.updateNotebookMetadata({ ...notebook.metadata, custom: { ...(notebook.metadata.custom || {}), extraNotebookMetadata: true } }); edit.set(notebook.uri, [cellEdit, metdataEdit]); await vscode.workspace.applyEdit(edit); </ins> await notebookChangeEvent; <del> assert.strictEqual(version + 1, editor.document.version); </del> <ins> const notebookChangeEvent2 = asPromise<vscode.NotebookDocumentChangeEvent>(vscode.workspace.onDidChangeNotebookDocument); const edit2 = new vscode.WorkspaceEdit(); const cellMetadataEdit = vscode.NotebookEdit.updateCellMetadata(0, { extraCellMetadata: true }); edit2.set(notebook.uri, [cellMetadataEdit]); await vscode.workspace.applyEdit(edit2); await notebookChangeEvent2; assert.strictEqual(version + 2, editor.notebook.version); const cell = editor.notebook.cellAt(0); assert.ok(editor.notebook.metadata.custom.extraNotebookMetadata, `Test metadata not found`); assert.ok(cell.metadata.extraCellMetadata, `Test cell metdata not found`); </ins> }); test('edit API batch edits undo/redo', async function () {

if (NotebookEdit.isNotebookCellEdit(edit)) { if (edit.newCellMetadata) { this.replaceNotebookCellMetadata(uri, edit.range.start, edit.newCellMetadata); <ins> } else if (edit.newNotebookMetadata) { this.replaceNotebookMetadata(uri, edit.newNotebookMetadata); </ins> } else { this.replaceNotebookCells(uri, edit.range, edit.newCells); }