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

Error: "NO notebook document for '...'" when repeatedly opening untitled notebooks #207742

Closed
kycutler opened this issue Mar 14, 2024 · 0 comments
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders
Milestone

Comments

@kycutler
Copy link
Contributor

Does this issue occur when all extensions are disabled?: Possibly no (I have only been able to reproduce it with Jupyter+Python enabled, or using a custom extension)

  • VS Code Version: 1.88.0-insider
  • OS Version: Windows 11

Steps to Reproduce:

  1. Open a fresh VS Code Insiders window
  2. Run the command "Create: New Jupyter Notebook"
  3. Close the new tab and discard changes
  4. Repeat steps 2 & 3
  5. An error may appear after a few tries. If it doesn't, open a new VS Code window and try again

image

I have also had success reproducing the issue using a custom extension with the following code:

// 1. Create an untitled notebook.
const notebook = await vscode.workspace.openNotebookDocument(
	"jupyter-notebook",
	new vscode.NotebookData([new vscode.NotebookCellData(vscode.NotebookCellKind.Code, "123", "python")])
);

// 2. Open a second document so the notebook is not visible.
const textDoc = await vscode.workspace.openTextDocument({
	content: "foo bar"
});
await vscode.window.showTextDocument(textDoc);

// 3. Add a new cell to the notebook document.
const edit = new vscode.WorkspaceEdit();
const notebookEdit = new vscode.NotebookEdit(new vscode.NotebookRange(1, 1), [
	{
		kind: vscode.NotebookCellKind.Code,
		value: "456",
		languageId: "python",
		outputs: []
	}
]);
edit.set(notebook.uri, [notebookEdit]);
await vscode.workspace.applyEdit(edit);

// 4. Switch to the notebook document
await vscode.window.showNotebookDocument(notebook);

// 5. Close all editors (Select "Don't save" when prompted)
await vscode.commands.executeCommand("workbench.action.closeAllEditors");

// 6. Create another untitled notebook. This should fail.
await vscode.workspace.openNotebookDocument(
	"jupyter-notebook",
	new vscode.NotebookData([new vscode.NotebookCellData(vscode.NotebookCellKind.Code, "123", "python")])
);
rebornix added a commit that referenced this issue Mar 14, 2024
rebornix added a commit that referenced this issue Mar 15, 2024
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Mar 15, 2024
@VSCodeTriageBot VSCodeTriageBot added this to the March 2024 milestone Mar 15, 2024
@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Mar 15, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders
Projects
None yet
Development

No branches or pull requests

3 participants