From 30b8e105f93e90368e3857e7b84d8044fd5d6fb7 Mon Sep 17 00:00:00 2001 From: Kevin Cunnane Date: Tue, 9 Apr 2019 14:11:10 -0700 Subject: [PATCH] Fix #4893 New Notebook Can Open Existing Noteboon (#4959) Add back check for textDocuments with same name, should've been there anyhow On rehydration files show as text docs before clicking as only get changed by customInputConverter code path. We should look at this long term - ideally we'd update notebookDocuments with correct values on initial start. #4958 opened to track this. --- extensions/notebook/src/extension.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/notebook/src/extension.ts b/extensions/notebook/src/extension.ts index ad4ab65c30..9db895052d 100644 --- a/extensions/notebook/src/extension.ts +++ b/extensions/notebook/src/extension.ts @@ -75,8 +75,9 @@ function findNextUntitledEditorName(): string { // Note: this will go forever if it's coded wrong, or you have infinite Untitled notebooks! while (true) { let title = `Notebook-${nextVal}`; + let hasTextDoc = vscode.workspace.textDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1; let hasNotebookDoc = azdata.nb.notebookDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1; - if (!hasNotebookDoc) { + if (!hasTextDoc && !hasNotebookDoc) { return title; } nextVal++;