Merge pull request #75273 from microsoft/isidorn/workspaceRemoteLimit

Do not allow workspace folders with scheme different than the current…
This commit is contained in:
Isidor Nikolic 2019-06-12 12:37:05 +02:00 committed by GitHub
commit 46a9c6d481
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -593,11 +593,11 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
// Desktop DND (Import file)
if (data instanceof DesktopDragAndDropData) {
this.handleExternalDrop(data, target, originalEvent);
this.handleExternalDrop(data, target, originalEvent).then(undefined, e => this.notificationService.warn(e));
}
// In-Explorer DND (Move/Copy file)
else {
this.handleExplorerDrop(data, target, originalEvent);
this.handleExplorerDrop(data, target, originalEvent).then(undefined, e => this.notificationService.warn(e));
}
}

View file

@ -216,6 +216,13 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
private async doAddFolders(foldersToAdd: IWorkspaceFolderCreationData[], index?: number, donotNotifyError: boolean = false): Promise<void> {
const state = this.contextService.getWorkbenchState();
if (this.environmentService.configuration.remoteAuthority) {
// Do not allow workspace folders with scheme different than the current remote scheme
const schemas = this.contextService.getWorkspace().folders.map(f => f.uri.scheme);
if (schemas.length && foldersToAdd.some(f => schemas.indexOf(f.uri.scheme) === -1)) {
return Promise.reject(new Error(nls.localize('differentSchemeRoots', "Workspace folders from different providers are not allowed in the same workspace.")));
}
}
// If we are in no-workspace or single-folder workspace, adding folders has to
// enter a workspace.