From 6a1037ab2d8bda66ae1d4872fb564943d134d9c1 Mon Sep 17 00:00:00 2001 From: Jorge Berumen <52225468+joberume@users.noreply.github.com> Date: Fri, 13 Mar 2020 18:10:55 -0700 Subject: [PATCH] Fix trusting opened notebooks (#9615) * Fix trusting opened notebooks * Addressing comments --- extensions/notebook/src/book/bookTreeView.ts | 13 +++++++++++++ extensions/notebook/src/common/apiWrapper.ts | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/extensions/notebook/src/book/bookTreeView.ts b/extensions/notebook/src/book/bookTreeView.ts index cd7c71076c..d4f5cd7095 100644 --- a/extensions/notebook/src/book/bookTreeView.ts +++ b/extensions/notebook/src/book/bookTreeView.ts @@ -74,9 +74,22 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider { + let notebook = this.currentBook.getNotebook(document.uri.fsPath); + if (notebook && this._bookTrustManager.isNotebookTrustedByDefault(document.uri.fsPath)) { + document.setTrusted(true); + } + }); + } this._apiWrapper.showInfoMessage(loc.msgBookTrusted); } else { this._apiWrapper.showInfoMessage(loc.msgBookAlreadyTrusted); diff --git a/extensions/notebook/src/common/apiWrapper.ts b/extensions/notebook/src/common/apiWrapper.ts index 370fb6eafe..e7c106f282 100644 --- a/extensions/notebook/src/common/apiWrapper.ts +++ b/extensions/notebook/src/common/apiWrapper.ts @@ -65,6 +65,10 @@ export class ApiWrapper { return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value); } + public getNotebookDocuments() { + return azdata.nb.notebookDocuments; + } + /** * Get the configuration for a extensionName * @param extensionName The string name of the extension to get the configuration for