diff --git a/package.nls.json b/package.nls.json index c3638945435e..244a4ffefc9b 100644 --- a/package.nls.json +++ b/package.nls.json @@ -32,9 +32,10 @@ "DataScience.openExportFileNo": "No", "DataScience.failedExportMessage": "Export failed.", "DataScience.exportToPDFDependencyMessage": "If you have not installed xelatex (TeX) you will need to do so before you can export to PDF, for further instructions please look [here](https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex). \r\nTo avoid installing xelatex (TeX) you might want to try exporting to HTML and using your browsers \"Print to PDF\" feature.", - "DataScience.launchNotebookTrustPrompt": "A notebook could execute harmful code when opened. Some cells & outputs have been hidden. Do you trust this notebook? (To trust all notebooks by default, click [here](command:workbench.action.openSettings?%5B%22python.dataScience.alwaysTrustNotebooks%22%5D).) [Learn more.](https://aka.ms/trusted-notebooks)", + "DataScience.launchNotebookTrustPrompt": "A notebook could execute harmful code when opened. Some outputs have been hidden. Do you trust this notebook? [Learn more.](https://aka.ms/trusted-notebooks)", "DataScience.launchNotebookTrustPrompt.yes": "Trust", "DataScience.launchNotebookTrustPrompt.no": "Do not trust", + "DataScience.launchNotebookTrustPrompt.trustAllNotebooks": "Trust all notebooks", "python.command.python.viewLanguageServerOutput.title": "Show Language Server Output", "python.command.python.selectAndRunTestMethod.title": "Run Test Method ...", "python.command.python.selectAndDebugTestMethod.title": "Debug Test Method ...", diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 455069417e30..0f7629b79ed6 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -1024,10 +1024,14 @@ export namespace DataScience { ); export const launchNotebookTrustPrompt = localize( 'DataScience.launchNotebookTrustPrompt', - 'A notebook could execute harmful code when opened. Some cells & outputs have been hidden. Do you trust this notebook? (To trust all notebooks by default, click [here](command:workbench.action.openSettings?%5B%22python.dataScience.alwaysTrustNotebooks%22%5D).) [Learn more.](https://aka.ms/trusted-notebooks)' + 'A notebook could execute harmful code when opened. Some outputs have been hidden. Do you trust this notebook? [Learn more.](https://aka.ms/trusted-notebooks)' ); export const trustNotebook = localize('DataScience.launchNotebookTrustPrompt.yes', 'Trust'); export const doNotTrustNotebook = localize('DataScience.launchNotebookTrustPrompt.no', 'Do not trust'); + export const trustAllNotebooks = localize( + 'DataScience.launchNotebookTrustPrompt.trustAllNotebooks', + 'Trust all notebooks' + ); export const previewNotebookOnlySupportedInVSCInsiders = localize( 'DataScience.previewNotebookOnlySupportedInVSCInsiders', 'The Preview Notebook Editor is supported only in the Insiders version of Visual Studio Code.' diff --git a/src/client/datascience/interactive-ipynb/digestStorage.ts b/src/client/datascience/interactive-ipynb/digestStorage.ts index cb6887c81725..cba0fa78c91e 100644 --- a/src/client/datascience/interactive-ipynb/digestStorage.ts +++ b/src/client/datascience/interactive-ipynb/digestStorage.ts @@ -9,7 +9,6 @@ import { IFileSystem } from '../../common/platform/types'; import { IExtensionContext } from '../../common/types'; import { IDigestStorage } from '../types'; -// NB: still need to implement automatic culling of least recently used entries @injectable() export class DigestStorage implements IDigestStorage { public readonly key: Promise; diff --git a/src/client/datascience/interactive-ipynb/nativeEditor.ts b/src/client/datascience/interactive-ipynb/nativeEditor.ts index ef299a60b1ed..7e2953cf8b3e 100644 --- a/src/client/datascience/interactive-ipynb/nativeEditor.ts +++ b/src/client/datascience/interactive-ipynb/nativeEditor.ts @@ -6,6 +6,7 @@ import * as path from 'path'; import { CancellationToken, CancellationTokenSource, + commands, Event, EventEmitter, Memento, @@ -611,7 +612,11 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor { } private async launchNotebookTrustPrompt() { - const prompts = [localize.DataScience.trustNotebook(), localize.DataScience.doNotTrustNotebook()]; + const prompts = [ + localize.DataScience.trustNotebook(), + localize.DataScience.doNotTrustNotebook(), + localize.DataScience.trustAllNotebooks() + ]; const selection = await this.applicationShell.showErrorMessage( localize.DataScience.launchNotebookTrustPrompt(), ...prompts @@ -636,6 +641,9 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor { } catch (err) { traceError(err); } + } else if (selection === localize.DataScience.trustAllNotebooks()) { + // Take the user to the settings UI where they can manually turn on the alwaysTrustNotebooks setting + commands.executeCommand('workbench.action.openSettings', 'python.dataScience.alwaysTrustNotebooks'); } }