Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463 (#7206)

* Merge from vscode 64980ea1f3f532c82bb6c28d27bba9ef2c5b4463

* fix config changes

* fix strictnull checks
This commit is contained in:
Anthony Dresser
2019-09-15 22:38:26 -07:00
committed by GitHub
parent fa6c52699e
commit ea0f9e6ce9
1226 changed files with 21541 additions and 17633 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ITextBufferFactory, ITextSnapshot } from 'vs/editor/common/model';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { joinPath, relativePath } from 'vs/base/common/resources';
@@ -21,7 +21,7 @@ export interface IResolvedBackup<T extends object> {
*/
export interface IBackupFileService {
_serviceBrand: ServiceIdentifier<IBackupFileService>;
_serviceBrand: undefined;
/**
* Finds out if there are any backups stored.
@@ -91,4 +91,4 @@ export interface IBackupFileService {
export function toBackupWorkspaceResource(backupWorkspacePath: string, environmentService: IEnvironmentService): URI {
return joinPath(environmentService.userRoamingDataHome, relativePath(URI.file(environmentService.userDataPath), URI.file(backupWorkspacePath))!);
}
}

View File

@@ -19,7 +19,6 @@ import { Schemas } from 'vs/base/common/network';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { VSBuffer } from 'vs/base/common/buffer';
import { TextSnapshotReadable } from 'vs/workbench/services/textfile/common/textfiles';
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
export interface IBackupFilesModel {
resolve(backupRoot: URI): Promise<IBackupFilesModel>;
@@ -106,7 +105,7 @@ export class BackupFilesModel implements IBackupFilesModel {
export class BackupFileService implements IBackupFileService {
_serviceBrand!: ServiceIdentifier<IBackupFileService>;
_serviceBrand: undefined;
private impl: IBackupFileService;
@@ -114,7 +113,7 @@ export class BackupFileService implements IBackupFileService {
@IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService,
@IFileService protected fileService: IFileService
) {
this.initialize();
this.impl = this.initialize();
}
protected hashPath(resource: URI): string {
@@ -123,13 +122,13 @@ export class BackupFileService implements IBackupFileService {
return hash(str).toString(16);
}
private initialize(): void {
private initialize(): IBackupFileService {
const backupWorkspaceResource = this.environmentService.configuration.backupWorkspaceResource;
if (backupWorkspaceResource) {
this.impl = new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, this.fileService);
} else {
this.impl = new InMemoryBackupFileService(this.hashPath);
return new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, this.fileService);
}
return new InMemoryBackupFileService(this.hashPath);
}
reinitialize(): void {
@@ -188,7 +187,7 @@ class BackupFileServiceImpl implements IBackupFileService {
private static readonly PREAMBLE_META_SEPARATOR = ' '; // using a character that is know to be escaped in a URI as separator
private static readonly PREAMBLE_MAX_LENGTH = 10000;
_serviceBrand!: ServiceIdentifier<IBackupFileService>;
_serviceBrand: undefined;
private backupWorkspacePath!: URI;
@@ -398,7 +397,7 @@ class BackupFileServiceImpl implements IBackupFileService {
export class InMemoryBackupFileService implements IBackupFileService {
_serviceBrand!: ServiceIdentifier<IBackupFileService>;
_serviceBrand: undefined;
private backups: Map<string, ITextSnapshot> = new Map();

View File

@@ -21,7 +21,7 @@ import { FileService } from 'vs/platform/files/common/fileService';
import { NullLogService } from 'vs/platform/log/common/log';
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
import { WorkbenchEnvironmentService } from 'vs/workbench/services/environment/node/environmentService';
import { parseArgs } from 'vs/platform/environment/node/argv';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { snapshotToString } from 'vs/workbench/services/textfile/common/textfiles';
import { IFileService } from 'vs/platform/files/common/files';
import { hashPath, BackupFileService } from 'vs/workbench/services/backup/node/backupFileService';
@@ -49,7 +49,7 @@ const untitledBackupPath = path.join(workspaceBackupPath, 'untitled', hashPath(u
class TestBackupEnvironmentService extends WorkbenchEnvironmentService {
constructor(backupPath: string) {
super({ ...parseArgs(process.argv), ...{ backupPath, 'user-data-dir': userdataDir } } as IWindowConfiguration, process.execPath);
super({ ...parseArgs(process.argv, OPTIONS), ...{ backupPath, 'user-data-dir': userdataDir } } as IWindowConfiguration, process.execPath);
}
}