From a6c8b82ceb2fcb0e5bed8167d2384aaaf5721486 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 24 Jan 2018 11:10:10 +0100 Subject: [PATCH] debug: compound configuration name error handling --- .../parts/debug/electron-browser/debugService.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 462d8d630a2d..ebe3ccf93d65 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -698,10 +698,16 @@ export class DebugService implements debug.IDebugService { return TPromise.as(null); } - let rootForName = root; + let rootForName: IWorkspaceFolder; const launchesContainingName = this.configurationManager.getLaunches().filter(l => !!l.getConfiguration(name)); - if (launchesContainingName && launchesContainingName.length === 1) { + if (launchesContainingName.length === 1) { rootForName = launchesContainingName[0].workspace; + } else if (launchesContainingName.length > 1 && launchesContainingName.indexOf(launch) >= 0) { + // If there are multiple launches containing the configuration give priority to the configuration in the current launch + rootForName = launch.workspace; + } else { + return TPromise.wrapError(new Error(launchesContainingName.length === 0 ? nls.localize('noConfigurationNameInWorkspace', "Could not find launch configuration '{0}' in the workspace.", name) + : nls.localize('multipleConfigurationNamesInWorkspace', "There are multiple launch configurates `{0}` in the workspace. Use folder name to qualify the configuration.", name))); } return this.startDebugging(rootForName, name, noDebug, topCompoundName || compound.name);