save in the extension host for non-remote cases as well (#209988)

This commit is contained in:
Aaron Munger
2024-04-09 15:30:29 -07:00
committed by GitHub
parent 9c98056dd7
commit 52dc2fd066
@@ -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;
};
}
}
}