Merge from vscode 3bd60b2ba753e7fe39b42f99184bc6c5881d3551 (#4712)

This commit is contained in:
Anthony Dresser
2019-03-27 11:36:01 -07:00
committed by GitHub
parent eac3420583
commit 46b7afe558
36 changed files with 303 additions and 137 deletions

View File

@@ -21,7 +21,7 @@ import { BackupFileService } from 'vs/workbench/services/backup/node/backupFileS
import { ICommandService } from 'vs/platform/commands/common/commands';
import { distinct } from 'vs/base/common/arrays';
import { isLinux, isWindows, isMacintosh } from 'vs/base/common/platform';
import { isEqual, basename, isEqualOrParent } from 'vs/base/common/resources';
import { isEqual, basename, isEqualOrParent, getComparisonKey } from 'vs/base/common/resources';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IFileService } from 'vs/platform/files/common/files';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
@@ -205,7 +205,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
if (state !== WorkbenchState.WORKSPACE) {
let newWorkspaceFolders = this.contextService.getWorkspace().folders.map(folder => ({ uri: folder.uri } as IWorkspaceFolderCreationData));
newWorkspaceFolders.splice(typeof index === 'number' ? index : newWorkspaceFolders.length, 0, ...foldersToAdd);
newWorkspaceFolders = distinct(newWorkspaceFolders, folder => isLinux ? folder.uri.toString() : folder.uri.toString().toLowerCase());
newWorkspaceFolders = distinct(newWorkspaceFolders, folder => getComparisonKey(folder.uri));
if (state === WorkbenchState.EMPTY && newWorkspaceFolders.length === 0 || state === WorkbenchState.FOLDER && newWorkspaceFolders.length === 1) {
return Promise.resolve(); // return if the operation is a no-op for the current state
@@ -245,8 +245,8 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
if (path && !this.isValidTargetWorkspacePath(path)) {
return Promise.reject(null);
}
const untitledWorkspace = await this.workspaceService.createUntitledWorkspace(folders);
const remoteAuthority = this.windowService.getConfiguration().remoteAuthority;
const untitledWorkspace = await this.workspaceService.createUntitledWorkspace(folders, remoteAuthority);
if (path) {
await this.saveWorkspaceAs(untitledWorkspace, path);
} else {