提交 2aa29a98 编写于 作者: I isidor

Allow preLaunch task for compound list

fixes #45676
上级 4d71eba6
......@@ -289,6 +289,13 @@ export class DebugService implements IDebugService {
throw new Error(nls.localize({ key: 'compoundMustHaveConfigurations', comment: ['compound indicates a "compounds" configuration item', '"configurations" is an attribute and should not be localized'] },
"Compound must have \"configurations\" attribute set in order to start multiple configurations."));
}
if (compound.preLaunchTask) {
const taskResult = await this.runTaskAndCheckErrors(launch?.workspace || this.contextService.getWorkspace(), compound.preLaunchTask);
if (taskResult === TaskRunResult.Failure) {
this.endInitializingState();
return false;
}
}
const values = await Promise.all(compound.configurations.map(configData => {
const name = typeof configData === 'string' ? configData : configData.name;
......@@ -394,10 +401,10 @@ export class DebugService implements IDebugService {
return false;
}
const workspace = launch ? launch.workspace : undefined;
const workspace = launch ? launch.workspace : this.contextService.getWorkspace();
const taskResult = await this.runTaskAndCheckErrors(workspace, resolvedConfig.preLaunchTask);
if (taskResult === TaskRunResult.Success) {
return this.doCreateSession(workspace, { resolved: resolvedConfig, unresolved: unresolvedConfig }, options);
return this.doCreateSession(launch?.workspace, { resolved: resolvedConfig, unresolved: unresolvedConfig }, options);
}
return false;
} catch (err) {
......@@ -701,7 +708,7 @@ export class DebugService implements IDebugService {
//---- task management
private async runTaskAndCheckErrors(root: IWorkspaceFolder | undefined, taskId: string | TaskIdentifier | undefined): Promise<TaskRunResult> {
private async runTaskAndCheckErrors(root: IWorkspaceFolder | IWorkspace | undefined, taskId: string | TaskIdentifier | undefined): Promise<TaskRunResult> {
try {
const taskSummary = await this.runTask(root, taskId);
......
......@@ -505,6 +505,7 @@ export interface IConfig extends IEnvConfig {
export interface ICompound {
name: string;
preLaunchTask?: string | TaskIdentifier;
configurations: (string | { name: string, folder: string })[];
}
......
......@@ -190,6 +190,11 @@ export const launchSchema: IJSONSchema = {
}]
},
description: nls.localize('app.launch.json.compounds.configurations', "Names of configurations that will be started as part of this compound.")
},
preLaunchTask: {
type: 'string',
default: '',
description: nls.localize('compoundPrelaunchTask', "Task to run before any of the compound configurations start.")
}
},
default: defaultCompound
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册