Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save scope as part of the TaskService.lastTask #7553

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/task/src/browser/provided-task-configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ export class ProvidedTaskConfigurations {
if (labelConfigMap) {
const scopeConfigMap = labelConfigMap.get(taskLabel);
if (scopeConfigMap) {
return scopeConfigMap.get(scope);
if (scope) {
return scopeConfigMap.get(scope);
}
return Array.from(scopeConfigMap.values())[0];
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/task/src/browser/task-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class TaskService implements TaskConfigurationClient {
/**
* The last executed task.
*/
protected lastTask: { source: string, taskLabel: string } | undefined = undefined;
protected lastTask: { source: string, taskLabel: string, scope?: string } | undefined = undefined;
protected cachedRecentTasks: TaskConfiguration[] = [];
protected runningTasks = new Map<number, {
exitCode: Deferred<number | undefined>,
Expand Down Expand Up @@ -430,7 +430,7 @@ export class TaskService implements TaskConfigurationClient {
*
* @returns the last executed task or `undefined`.
*/
getLastTask(): { source: string, taskLabel: string } | undefined {
getLastTask(): { source: string, taskLabel: string, scope?: string } | undefined {
return this.lastTask;
}

Expand All @@ -455,8 +455,8 @@ export class TaskService implements TaskConfigurationClient {
if (!this.lastTask) {
return;
}
const { source, taskLabel } = this.lastTask;
return this.run(source, taskLabel);
const { source, taskLabel, scope } = this.lastTask;
return this.run(source, taskLabel, scope);
}

/**
Expand Down Expand Up @@ -908,7 +908,7 @@ export class TaskService implements TaskConfigurationClient {
const taskLabel = resolvedTask.label;
try {
const taskInfo = await this.taskServer.run(resolvedTask, this.getContext(), option);
this.lastTask = { source, taskLabel };
this.lastTask = { source, taskLabel, scope: resolvedTask._scope };
this.logger.debug(`Task created. Task id: ${taskInfo.taskId}`);

/**
Expand Down