From 52dc2fd066c19189ad2267b2a732c257223cf07b Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Tue, 9 Apr 2024 15:30:29 -0700 Subject: [PATCH] save in the extension host for non-remote cases as well (#209988) --- .../notebook/common/notebookEditorModel.ts | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts b/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts index e91e96ece99c..b4077a8456c4 100644 --- a/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts +++ b/src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts @@ -218,28 +218,26 @@ export class NotebookFileWorkingCopyModel extends Disposable implements IStoredF } })); - if (_notebookModel.uri.scheme === Schemas.vscodeRemote) { - this.configuration = { - // Intentionally pick a larger delay for triggering backups when - // we are connected to a remote. This saves us repeated roundtrips - // to the remote server when the content changes because the - // remote hosts the extension of the notebook with the contents truth - backupDelay: 10000 + this.configuration = { + // Intentionally pick a larger delay for triggering backups when + // we are connected to a remote. This saves us repeated roundtrips + // to the remote server when the content changes because the + // remote hosts the extension of the notebook with the contents truth + backupDelay: 10000 + }; + + // Override save behavior to avoid transferring the buffer across the wire 3 times + if (this._configurationService.getValue(NotebookSetting.remoteSaving)) { + this.save = async (options: IWriteFileOptions, token: CancellationToken) => { + const serializer = await this.getNotebookSerializer(); + + if (token.isCancellationRequested) { + throw new CancellationError(); + } + + const stat = await serializer.save(this._notebookModel.uri, this._notebookModel.versionId, options, token); + return stat; }; - - // Override save behavior to avoid transferring the buffer across the wire 3 times - if (this._configurationService.getValue(NotebookSetting.remoteSaving)) { - this.save = async (options: IWriteFileOptions, token: CancellationToken) => { - const serializer = await this.getNotebookSerializer(); - - if (token.isCancellationRequested) { - throw new CancellationError(); - } - - const stat = await serializer.save(this._notebookModel.uri, this._notebookModel.versionId, options, token); - return stat; - }; - } } }