Rremove async from promise executors

Part of #134873
This commit is contained in:
Alex Ross
2021-11-01 11:11:13 +01:00
parent dac5e62a52
commit fb4c12bfff
5 changed files with 48 additions and 47 deletions

View File

@@ -642,13 +642,20 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask
if (result) {
return result;
}
// eslint-disable-next-line no-async-promise-executor
const createdResult: Promise<TaskExecutionImpl> = new Promise(async (resolve, reject) => {
const taskToCreate = task ? task : await TaskDTO.to(execution.task, this._workspaceProvider, this._providedCustomExecutions2);
if (!taskToCreate) {
reject('Unexpected: Task does not exist.');
const createdResult: Promise<TaskExecutionImpl> = new Promise((resolve, reject) => {
function resolvePromiseWithCreatedTask(that: ExtHostTaskBase, execution: tasks.TaskExecutionDTO, taskToCreate: vscode.Task | types.Task | undefined) {
if (!taskToCreate) {
reject('Unexpected: Task does not exist.');
} else {
resolve(new TaskExecutionImpl(that, execution.id, taskToCreate));
}
}
if (task) {
resolvePromiseWithCreatedTask(this, execution, task);
} else {
resolve(new TaskExecutionImpl(this, execution.id, taskToCreate));
TaskDTO.to(execution.task, this._workspaceProvider, this._providedCustomExecutions2)
.then(task => resolvePromiseWithCreatedTask(this, execution, task));
}
});