提交 0e56130b 编写于 作者: G Gabriel DeBacker 提交者: Alex Ross

Fix issue with CustomExecutions not working through tasks.executeTask (#79132)

* Do not clear out the map, and track the provided execution during execute task

* Clear provided custom executions map on execution complete

* Save last custom execution
上级 40921e09
...@@ -444,6 +444,14 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -444,6 +444,14 @@ export class ExtHostTask implements ExtHostTaskShape {
if (dto === undefined) { if (dto === undefined) {
return Promise.reject(new Error('Task is not valid')); return Promise.reject(new Error('Task is not valid'));
} }
// If this task is a custom execution, then we need to save it away
// in the provided custom execution map that is cleaned up after the
// task is executed.
if (CustomExecution2DTO.is(dto.execution)) {
await this.addCustomExecution2(dto, <vscode.Task2>task);
}
return this._proxy.$executeTask(dto).then(value => this.getTaskExecution(value, task)); return this._proxy.$executeTask(dto).then(value => this.getTaskExecution(value, task));
} }
} }
...@@ -529,11 +537,6 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -529,11 +537,6 @@ export class ExtHostTask implements ExtHostTaskShape {
return Promise.reject(new Error('no handler found')); return Promise.reject(new Error('no handler found'));
} }
// For custom execution tasks, we need to store the execution objects locally
// since we obviously cannot send callback functions through the proxy.
// So, clear out any existing ones.
this._providedCustomExecutions2.clear();
// Set up a list of task ID promises that we can wait on // Set up a list of task ID promises that we can wait on
// before returning the provided tasks. The ensures that // before returning the provided tasks. The ensures that
// our task IDs are calculated for any custom execution tasks. // our task IDs are calculated for any custom execution tasks.
...@@ -692,5 +695,17 @@ export class ExtHostTask implements ExtHostTaskShape { ...@@ -692,5 +695,17 @@ export class ExtHostTask implements ExtHostTaskShape {
if (extensionCallback2) { if (extensionCallback2) {
this._activeCustomExecutions2.delete(execution.id); this._activeCustomExecutions2.delete(execution.id);
} }
const lastCustomExecution = this._providedCustomExecutions2.get(execution.id);
// Technically we don't really need to do this, however, if an extension
// is executing a task through "executeTask" over and over again
// with different properties in the task definition, then this list
// could grow indefinitely, something we don't want.
this._providedCustomExecutions2.clear();
// We do still need to hang on to the last custom execution so that the
// Rerun Task command doesn't choke when it tries to rerun a custom execution
if (lastCustomExecution) {
this._providedCustomExecutions2.set(execution.id, lastCustomExecution);
}
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册