Merge from vscode 93309f060778f6480a7d2a13913e6e7c624e9bc7

This commit is contained in:
ADS Merger
2020-03-26 07:08:23 +00:00
parent 685e0ccf7e
commit f5134198e2
87 changed files with 942 additions and 631 deletions

View File

@@ -20,6 +20,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { VSBuffer } from 'vs/base/common/buffer';
import { TextSnapshotReadable, stringToSnapshot } from 'vs/workbench/services/textfile/common/textfiles';
import { Disposable } from 'vs/base/common/lifecycle';
import { ILogService } from 'vs/platform/log/common/log';
export interface IBackupFilesModel {
resolve(backupRoot: URI): Promise<IBackupFilesModel>;
@@ -114,7 +115,8 @@ export class BackupFileService implements IBackupFileService {
constructor(
@IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService,
@IFileService protected fileService: IFileService
@IFileService protected fileService: IFileService,
@ILogService private readonly logService: ILogService
) {
this.impl = this.initialize();
}
@@ -128,7 +130,7 @@ export class BackupFileService implements IBackupFileService {
private initialize(): BackupFileServiceImpl | InMemoryBackupFileService {
const backupWorkspaceResource = this.environmentService.configuration.backupWorkspaceResource;
if (backupWorkspaceResource) {
return new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, this.fileService);
return new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, this.fileService, this.logService);
}
return new InMemoryBackupFileService(this.hashPath);
@@ -194,7 +196,8 @@ class BackupFileServiceImpl extends Disposable implements IBackupFileService {
constructor(
backupWorkspaceResource: URI,
private readonly hashPath: (resource: URI) => string,
@IFileService private readonly fileService: IFileService
@IFileService private readonly fileService: IFileService,
@ILogService private readonly logService: ILogService
) {
super();
@@ -372,7 +375,9 @@ class BackupFileServiceImpl extends Disposable implements IBackupFileService {
// the meta-end marker ('\n') and as such the backup can only be invalid. We bail out
// here if that is the case.
if (!metaEndFound) {
throw new Error(`Backup: Could not find meta end marker in ${backupResource}. The file is probably corrupt.`);
this.logService.error(`Backup: Could not find meta end marker in ${backupResource}. The file is probably corrupt.`);
return undefined;
}
return { value: factory, meta };