Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,9 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import Uri from 'vs/base/common/uri';
import { URI as Uri } from 'vs/base/common/uri';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { TPromise } from 'vs/base/common/winjs.base';
import { IResolveContentOptions, IUpdateContentOptions, ITextSnapshot } from 'vs/platform/files/common/files';
@@ -33,7 +31,7 @@ export interface IBackupFileService {
* @param resource The resource that is backed up.
* @return The backup resource if any.
*/
loadBackupResource(resource: Uri): TPromise<Uri>;
loadBackupResource(resource: Uri): TPromise<Uri | undefined>;
/**
* Given a resource, returns the associated backup resource.
@@ -65,7 +63,7 @@ export interface IBackupFileService {
* @param value The contents from a backup resource as stream.
* @return The backup file's backed up content as text buffer factory.
*/
resolveBackupContent(backup: Uri): TPromise<ITextBufferFactory>;
resolveBackupContent(backup: Uri): TPromise<ITextBufferFactory | undefined>;
/**
* Discards the backup associated with a resource if it exists..

View File

@@ -3,12 +3,10 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as path from 'path';
import * as crypto from 'crypto';
import * as pfs from 'vs/base/node/pfs';
import Uri from 'vs/base/common/uri';
import { URI as Uri } from 'vs/base/common/uri';
import { ResourceQueue } from 'vs/base/common/async';
import { IBackupFileService, BACKUP_FILE_UPDATE_OPTIONS, BACKUP_FILE_RESOLVE_OPTIONS } from 'vs/workbench/services/backup/common/backup';
import { IFileService, ITextSnapshot } from 'vs/platform/files/common/files';
@@ -34,7 +32,7 @@ export class BackupSnapshot implements ITextSnapshot {
constructor(private snapshot: ITextSnapshot, private preamble: string) { }
read(): string {
read(): string | null {
let value = this.snapshot.read();
if (!this.preambleHandled) {
this.preambleHandled = true;
@@ -147,7 +145,7 @@ export class BackupFileService implements IBackupFileService {
});
}
loadBackupResource(resource: Uri): TPromise<Uri> {
loadBackupResource(resource: Uri): TPromise<Uri | undefined> {
return this.ready.then(model => {
// Return directly if we have a known backup with that resource
@@ -254,7 +252,7 @@ export class InMemoryBackupFileService implements IBackupFileService {
return TPromise.as(this.backups.size > 0);
}
loadBackupResource(resource: Uri): TPromise<Uri> {
loadBackupResource(resource: Uri): TPromise<Uri | undefined> {
const backupResource = this.toBackupResource(resource);
if (this.backups.has(backupResource.toString())) {
return TPromise.as(backupResource);
@@ -270,7 +268,7 @@ export class InMemoryBackupFileService implements IBackupFileService {
return TPromise.as(void 0);
}
resolveBackupContent(backupResource: Uri): TPromise<ITextBufferFactory> {
resolveBackupContent(backupResource: Uri): TPromise<ITextBufferFactory | undefined> {
const snapshot = this.backups.get(backupResource.toString());
if (snapshot) {
return TPromise.as(createTextBufferFactoryFromSnapshot(snapshot));

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import * as platform from 'vs/base/common/platform';
import * as crypto from 'crypto';
@@ -12,7 +10,7 @@ import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import * as pfs from 'vs/base/node/pfs';
import Uri from 'vs/base/common/uri';
import { URI as Uri } from 'vs/base/common/uri';
import { BackupFileService, BackupFilesModel } from 'vs/workbench/services/backup/node/backupFileService';
import { FileService } from 'vs/workbench/services/files/electron-browser/fileService';
import { TextModel, createTextBufferFactory } from 'vs/editor/common/model/textModel';
@@ -39,7 +37,7 @@ const untitledBackupPath = path.join(workspaceBackupPath, 'untitled', crypto.cre
class TestBackupFileService extends BackupFileService {
constructor(workspace: Uri, backupHome: string, workspacesJsonPath: string) {
const fileService = new FileService(new TestContextService(new Workspace(workspace.fsPath, workspace.fsPath, toWorkspaceFolders([{ path: workspace.fsPath }]))), TestEnvironmentService, new TestTextResourceConfigurationService(), new TestConfigurationService(), new TestLifecycleService(), new TestStorageService(), new TestNotificationService(), { disableWatcher: true });
const fileService = new FileService(new TestContextService(new Workspace(workspace.fsPath, toWorkspaceFolders([{ path: workspace.fsPath }]))), TestEnvironmentService, new TestTextResourceConfigurationService(), new TestConfigurationService(), new TestLifecycleService(), new TestStorageService(), new TestNotificationService(), { disableWatcher: true });
super(workspaceBackupPath, fileService);
}