diff --git a/extensions/ipynb/package.json b/extensions/ipynb/package.json index d881eb8ca22..784a352ad96 100644 --- a/extensions/ipynb/package.json +++ b/extensions/ipynb/package.json @@ -39,6 +39,12 @@ "scope": "resource", "markdownDescription": "%ipynb.pasteImagesAsAttachments.enabled%", "default": true + }, + "ipynb.experimental.serialization": { + "type": "boolean", + "scope": "resource", + "markdownDescription": "%ipynb.experimental.serialization%", + "default": false } } } diff --git a/extensions/ipynb/package.nls.json b/extensions/ipynb/package.nls.json index 7a3d95181cf..61eb74e242d 100644 --- a/extensions/ipynb/package.nls.json +++ b/extensions/ipynb/package.nls.json @@ -2,6 +2,7 @@ "displayName": ".ipynb Support", "description": "Provides basic support for opening and reading Jupyter's .ipynb notebook files", "ipynb.pasteImagesAsAttachments.enabled": "Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.", + "ipynb.experimental.serialization": "Experimental feature to serialize the Jupyter notebook in a worker thread.", "newUntitledIpynb.title": "New Jupyter Notebook", "newUntitledIpynb.shortTitle": "Jupyter Notebook", "openIpynbInNotebookEditor.title": "Open IPYNB File In Notebook Editor", diff --git a/extensions/ipynb/src/notebookSerializer.ts b/extensions/ipynb/src/notebookSerializer.ts index ead5baa341b..97d83c34db9 100644 --- a/extensions/ipynb/src/notebookSerializer.ts +++ b/extensions/ipynb/src/notebookSerializer.ts @@ -107,10 +107,15 @@ export class NotebookSerializer implements vscode.NotebookSerializer { data.metadata.indentAmount : ' '; - return this.serializeViaWorker({ - notebookContent: sorted, - indentAmount - }); + const experimentalSave = vscode.workspace.getConfiguration('ipynb').get('experimental.serialization', false); + if (experimentalSave) { + return this.serializeViaWorker({ + notebookContent: sorted, + indentAmount + }); + } else { + return Promise.resolve(JSON.stringify(sorted, undefined, indentAmount)); + } } }