Update task provider sample for resolveTask

This commit is contained in:
Alex Ross
2019-08-07 17:30:13 +02:00
parent 30a6bf29aa
commit 5fb626a4e3

View File

@ -27,6 +27,14 @@ export class RakeTaskProvider implements vscode.TaskProvider {
}
public resolveTask(_task: vscode.Task): vscode.Task | undefined {
const task = _task.definition.task;
// A Rake task consists of a task and an optional file as specified in RakeTaskDefinition
// Make sure that this looks like a Rake task by checking that there is a task.
if (task) {
// resolveTask requires that the same definition object be used.
const definition: RakeTaskDefinition = <any>_task.definition;
return new vscode.Task(definition, definition.task, 'rake', new vscode.ShellExecution(`rake ${definition.task}`));
}
return undefined;
}
}