提交 fedcd864 编写于 作者: I isidor

debug: allow scoping of configurations inside compounds

fixes #38134
上级 6cdee10a
...@@ -363,7 +363,7 @@ export interface IConfig extends IEnvConfig { ...@@ -363,7 +363,7 @@ export interface IConfig extends IEnvConfig {
export interface ICompound { export interface ICompound {
name: string; name: string;
configurations: string[]; configurations: (string | { name: string, folder: string })[];
} }
export interface IAdapterExecutable { export interface IAdapterExecutable {
......
...@@ -191,7 +191,18 @@ const schema: IJSONSchema = { ...@@ -191,7 +191,18 @@ const schema: IJSONSchema = {
enum: [], enum: [],
description: nls.localize('useUniqueNames', "Please use unique configuration names.") description: nls.localize('useUniqueNames', "Please use unique configuration names.")
}, { }, {
type: 'object' type: 'object',
required: ['name'],
properties: {
name: {
type: 'string',
description: nls.localize('app.launch.json.compound.name', "Name of compound. Appears in the launch configuration drop down menu.")
},
folder: {
type: 'string',
description: nls.localize('app.launch.json.compound.folder', "Name of folder in which the compound is located.")
}
}
}] }]
}, },
description: nls.localize('app.launch.json.compounds.configurations', "Names of configurations that will be started as part of this compound.") description: nls.localize('app.launch.json.compounds.configurations', "Names of configurations that will be started as part of this compound.")
......
...@@ -693,21 +693,31 @@ export class DebugService implements debug.IDebugService { ...@@ -693,21 +693,31 @@ export class DebugService implements debug.IDebugService {
"Compound must have \"configurations\" attribute set in order to start multiple configurations."))); "Compound must have \"configurations\" attribute set in order to start multiple configurations.")));
} }
return sequence(compound.configurations.map(name => () => { return TPromise.join(compound.configurations.map(configData => {
const name = typeof configData === 'string' ? configData : configData.name;
if (name === compound.name) { if (name === compound.name) {
return TPromise.as(null); return TPromise.as(null);
} }
let rootForName: IWorkspaceFolder; let rootForName: IWorkspaceFolder;
const launchesContainingName = this.configurationManager.getLaunches().filter(l => !!l.getConfiguration(name)); if (typeof configData === 'string') {
if (launchesContainingName.length === 1) { const launchesContainingName = this.configurationManager.getLaunches().filter(l => !!l.getConfiguration(name));
rootForName = launchesContainingName[0].workspace; if (launchesContainingName.length === 1) {
} else if (launchesContainingName.length > 1 && launchesContainingName.indexOf(launch) >= 0) { rootForName = launchesContainingName[0].workspace;
// If there are multiple launches containing the configuration give priority to the configuration in the current launch } else if (launchesContainingName.length > 1 && launchesContainingName.indexOf(launch) >= 0) {
rootForName = launch.workspace; // If there are multiple launches containing the configuration give priority to the configuration in the current launch
} else { rootForName = launch.workspace;
return TPromise.wrapError(new Error(launchesContainingName.length === 0 ? nls.localize('noConfigurationNameInWorkspace', "Could not find launch configuration '{0}' in the workspace.", name) } else {
: nls.localize('multipleConfigurationNamesInWorkspace', "There are multiple launch configurates `{0}` in the workspace. Use folder name to qualify the configuration.", name))); 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)));
}
} else if (configData.folder) {
const root = this.contextService.getWorkspace().folders.filter(f => f.name === configData.folder).pop();
if (root) {
rootForName = root;
} else {
return TPromise.wrapError(new Error(nls.localize('noFolderWithName', "Can not find folder with name '{0}' for configuration '{1}' in compound '{2}'.", configData.folder, configData.name, compound.name)));
}
} }
return this.startDebugging(rootForName, name, noDebug, topCompoundName || compound.name); return this.startDebugging(rootForName, name, noDebug, topCompoundName || compound.name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册