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

Cancellation token passed to resolveTask and provideTasks should not be optional #105818

Closed
jrieken opened this issue Sep 1, 2020 · 0 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders tasks Task system issues verified Verification succeeded

Comments

@jrieken
Copy link
Member

jrieken commented Sep 1, 2020

vscode/src/vs/vscode.d.ts

Lines 6261 to 6283 in 57e9e1a

export interface TaskProvider<T extends Task = Task> {
/**
* Provides tasks.
* @param token A cancellation token.
* @return an array of tasks
*/
provideTasks(token?: CancellationToken): ProviderResult<T[]>;
/**
* Resolves a task that has no [`execution`](#Task.execution) set. Tasks are
* often created from information found in the `tasks.json`-file. Such tasks miss
* the information on how to execute them and a task provider must fill in
* the missing information in the `resolveTask`-method. This method will not be
* called for tasks returned from the above `provideTasks` method since those
* tasks are always fully resolved. A valid default implementation for the
* `resolveTask` method is to return `undefined`.
*
* @param task The task to resolve.
* @param token A cancellation token.
* @return The resolved task
*/
resolveTask(task: T, token?: CancellationToken): ProviderResult<T>;
}

In both function the cancellation token is marked as optional which makes it hard to use. We remove the question marks and always pass a token, be it default None token

@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug tasks Task system issues labels Sep 1, 2020
@alexr00 alexr00 added this to the September 2020 milestone Sep 1, 2020
@alexr00 alexr00 closed this as completed in ab4892d Sep 8, 2020
@jrieken jrieken added the verified Verification succeeded label Sep 28, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders tasks Task system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants
@jrieken @alexr00 and others