Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -6,27 +6,10 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { URI } from 'vs/base/common/uri';
export interface ISerializedWorkspace { id: string; configURIPath: string; remoteAuthority?: string; }
export interface IBackupWorkspacesFormat {
rootURIWorkspaces: ISerializedWorkspace[];
folderURIWorkspaces: string[];
emptyWorkspaceInfos: IEmptyWindowBackupInfo[];
// deprecated
folderWorkspaces?: string[]; // use folderURIWorkspaces instead
emptyWorkspaces?: string[];
rootWorkspaces?: { id: string, configPath: string }[]; // use rootURIWorkspaces instead
}
import { IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup';
export const IBackupMainService = createDecorator<IBackupMainService>('backupMainService');
export interface IEmptyWindowBackupInfo {
backupFolder: string;
remoteAuthority?: string;
}
export interface IWorkspaceBackupInfo {
workspace: IWorkspaceIdentifier;
remoteAuthority?: string;
@@ -48,4 +31,4 @@ export interface IBackupMainService {
unregisterWorkspaceBackupSync(workspace: IWorkspaceIdentifier): void;
unregisterFolderBackupSync(folderUri: URI): void;
unregisterEmptyWindowBackupSync(backupFolder: string): void;
}
}

View File

@@ -9,7 +9,8 @@ import * as path from 'vs/base/common/path';
import * as platform from 'vs/base/common/platform';
import { writeFileSync, writeFile, readFile, readdir, exists, rimraf, rename, RimRafMode } from 'vs/base/node/pfs';
import * as arrays from 'vs/base/common/arrays';
import { IBackupMainService, IBackupWorkspacesFormat, IEmptyWindowBackupInfo, IWorkspaceBackupInfo } from 'vs/platform/backup/common/backup';
import { IBackupMainService, IWorkspaceBackupInfo } from 'vs/platform/backup/electron-main/backup';
import { IBackupWorkspacesFormat, IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IFilesConfiguration, HotExitConfiguration } from 'vs/platform/files/common/files';

View File

@@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export interface ISerializedWorkspace { id: string; configURIPath: string; remoteAuthority?: string; }
export interface IBackupWorkspacesFormat {
rootURIWorkspaces: ISerializedWorkspace[];
folderURIWorkspaces: string[];
emptyWorkspaceInfos: IEmptyWindowBackupInfo[];
// deprecated
folderWorkspaces?: string[]; // use folderURIWorkspaces instead
emptyWorkspaces?: string[];
rootWorkspaces?: { id: string, configPath: string }[]; // use rootURIWorkspaces instead
}
export interface IEmptyWindowBackupInfo {
backupFolder: string;
remoteAuthority?: string;
}

View File

@@ -9,11 +9,12 @@ import * as fs from 'fs';
import * as os from 'os';
import * as path from 'vs/base/common/path';
import * as pfs from 'vs/base/node/pfs';
import { URI as Uri, URI } from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService';
import { IBackupWorkspacesFormat, ISerializedWorkspace, IWorkspaceBackupInfo } from 'vs/platform/backup/common/backup';
import { IWorkspaceBackupInfo } from 'vs/platform/backup/electron-main/backup';
import { IBackupWorkspacesFormat, ISerializedWorkspace } from 'vs/platform/backup/node/backup';
import { HotExitConfiguration } from 'vs/platform/files/common/files';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { ConsoleLogMainService } from 'vs/platform/log/common/log';
@@ -24,7 +25,7 @@ import { Schemas } from 'vs/base/common/network';
suite('BackupMainService', () => {
function assertEqualUris(actual: Uri[], expected: Uri[]) {
function assertEqualUris(actual: URI[], expected: URI[]) {
assert.deepEqual(actual.map(a => a.toString()), expected.map(a => a.toString()));
}
@@ -43,12 +44,12 @@ suite('BackupMainService', () => {
this.workspacesJsonPath = backupWorkspacesPath;
}
public toBackupPath(arg: Uri | string): string {
const id = arg instanceof Uri ? super.getFolderHash(arg) : arg;
public toBackupPath(arg: URI | string): string {
const id = arg instanceof URI ? super.getFolderHash(arg) : arg;
return path.join(this.backupHome, id);
}
public getFolderHash(folderUri: Uri): string {
public getFolderHash(folderUri: URI): string {
return super.getFolderHash(folderUri);
}
@@ -81,7 +82,7 @@ suite('BackupMainService', () => {
};
}
async function ensureFolderExists(uri: Uri): Promise<void> {
async function ensureFolderExists(uri: URI): Promise<void> {
if (!fs.existsSync(uri.fsPath)) {
fs.mkdirSync(uri.fsPath);
}
@@ -110,10 +111,10 @@ suite('BackupMainService', () => {
return platform.isLinux ? p : p.toLowerCase();
}
const fooFile = Uri.file(platform.isWindows ? 'C:\\foo' : '/foo');
const barFile = Uri.file(platform.isWindows ? 'C:\\bar' : '/bar');
const fooFile = URI.file(platform.isWindows ? 'C:\\foo' : '/foo');
const barFile = URI.file(platform.isWindows ? 'C:\\bar' : '/bar');
const existingTestFolder1 = Uri.file(path.join(parentDir, 'folder1'));
const existingTestFolder1 = URI.file(path.join(parentDir, 'folder1'));
let service: TestBackupMainService;
let configService: TestConfigurationService;
@@ -231,7 +232,7 @@ suite('BackupMainService', () => {
const backupPathToMigrate = service.toBackupPath(fooFile);
fs.mkdirSync(backupPathToMigrate);
fs.writeFileSync(path.join(backupPathToMigrate, 'backup.txt'), 'Some Data');
service.registerFolderBackupSync(Uri.file(backupPathToMigrate));
service.registerFolderBackupSync(URI.file(backupPathToMigrate));
const workspaceBackupPath = service.registerWorkspaceBackupSync(toWorkspaceBackupInfo(barFile.fsPath), backupPathToMigrate);
@@ -247,12 +248,12 @@ suite('BackupMainService', () => {
const backupPathToMigrate = service.toBackupPath(fooFile);
fs.mkdirSync(backupPathToMigrate);
fs.writeFileSync(path.join(backupPathToMigrate, 'backup.txt'), 'Some Data');
service.registerFolderBackupSync(Uri.file(backupPathToMigrate));
service.registerFolderBackupSync(URI.file(backupPathToMigrate));
const backupPathToPreserve = service.toBackupPath(barFile);
fs.mkdirSync(backupPathToPreserve);
fs.writeFileSync(path.join(backupPathToPreserve, 'backup.txt'), 'Some Data');
service.registerFolderBackupSync(Uri.file(backupPathToPreserve));
service.registerFolderBackupSync(URI.file(backupPathToPreserve));
const workspaceBackupPath = service.registerWorkspaceBackupSync(toWorkspaceBackupInfo(barFile.fsPath), backupPathToMigrate);
@@ -270,8 +271,8 @@ suite('BackupMainService', () => {
test('migration folder path to URI makes sure to preserve existing backups', async () => {
let path1 = path.join(parentDir, 'folder1');
let path2 = path.join(parentDir, 'FOLDER2');
let uri1 = Uri.file(path1);
let uri2 = Uri.file(path2);
let uri1 = URI.file(path1);
let uri2 = URI.file(path2);
if (!fs.existsSync(path1)) {
fs.mkdirSync(path1);
@@ -372,8 +373,8 @@ suite('BackupMainService', () => {
});
test('getFolderBackupPaths() should return [] when files.hotExit = "onExitAndWindowClose"', async () => {
service.registerFolderBackupSync(Uri.file(fooFile.fsPath.toUpperCase()));
assertEqualUris(service.getFolderBackupPaths(), [Uri.file(fooFile.fsPath.toUpperCase())]);
service.registerFolderBackupSync(URI.file(fooFile.fsPath.toUpperCase()));
assertEqualUris(service.getFolderBackupPaths(), [URI.file(fooFile.fsPath.toUpperCase())]);
configService.setUserConfiguration('files.hotExit', HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE);
await service.initialize();
assertEqualUris(service.getFolderBackupPaths(), []);
@@ -591,11 +592,11 @@ suite('BackupMainService', () => {
});
test('should always store the workspace path in workspaces.json using the case given, regardless of whether the file system is case-sensitive (folder workspace)', () => {
service.registerFolderBackupSync(Uri.file(fooFile.fsPath.toUpperCase()));
assertEqualUris(service.getFolderBackupPaths(), [Uri.file(fooFile.fsPath.toUpperCase())]);
service.registerFolderBackupSync(URI.file(fooFile.fsPath.toUpperCase()));
assertEqualUris(service.getFolderBackupPaths(), [URI.file(fooFile.fsPath.toUpperCase())]);
return pfs.readFile(backupWorkspacesPath, 'utf-8').then(buffer => {
const json = <IBackupWorkspacesFormat>JSON.parse(buffer);
assert.deepEqual(json.folderURIWorkspaces, [Uri.file(fooFile.fsPath.toUpperCase()).toString()]);
assert.deepEqual(json.folderURIWorkspaces, [URI.file(fooFile.fsPath.toUpperCase()).toString()]);
});
});
@@ -681,11 +682,11 @@ suite('BackupMainService', () => {
}
if (platform.isMacintosh) {
assert.equal(service.getFolderHash(Uri.file('/foo')), service.getFolderHash(Uri.file('/FOO')));
assert.equal(service.getFolderHash(URI.file('/foo')), service.getFolderHash(URI.file('/FOO')));
}
if (platform.isWindows) {
assert.equal(service.getFolderHash(Uri.file('c:\\foo')), service.getFolderHash(Uri.file('C:\\FOO')));
assert.equal(service.getFolderHash(URI.file('c:\\foo')), service.getFolderHash(URI.file('C:\\FOO')));
}
});
});
@@ -693,7 +694,7 @@ suite('BackupMainService', () => {
suite('mixed path casing', () => {
test('should handle case insensitive paths properly (registerWindowForBackupsSync) (folder workspace)', () => {
service.registerFolderBackupSync(fooFile);
service.registerFolderBackupSync(Uri.file(fooFile.fsPath.toUpperCase()));
service.registerFolderBackupSync(URI.file(fooFile.fsPath.toUpperCase()));
if (platform.isLinux) {
assert.equal(service.getFolderBackupPaths().length, 2);
@@ -722,7 +723,7 @@ suite('BackupMainService', () => {
// mixed case
service.registerFolderBackupSync(fooFile);
service.unregisterFolderBackupSync(Uri.file(fooFile.fsPath.toUpperCase()));
service.unregisterFolderBackupSync(URI.file(fooFile.fsPath.toUpperCase()));
if (platform.isLinux) {
assert.equal(service.getFolderBackupPaths().length, 1);