src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.ts/BaseFileWorkingCopyManager/saveWithFallback
class BaseFileWorkingCopyManager:	private async saveWithFallback(workingCopy: W): Promise<void> {

		// First try regular save
		let saveFailed = false;
		try {
			await workingCopy.save();
		} catch (error) {
			saveFailed = true;
		}

		// Then fallback to backup if that exists
		if (saveFailed || workingCopy.isDirty()) {
			const backup = await this.workingCopyBackupService.resolve(workingCopy);
			if (backup) {
				await this.fileService.writeFile(workingCopy.resource, backup.value, { unlock: true });
			}
		}
	}