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
Stabilize CustomExecution task API #80375
Comments
@GabeDeBacker FYI |
One thing to note that I hit while consuming this proposed API which could be improved. This interface Pseudoterminal {
onDidClose?: Event<void | number>; At some point while that API was in the proposed state, it was renamed. And since it was optional, the TypeScript compiler did not inform me I was doing something wrong. Also took me a while to figure out what the issue was. I think it would be good to make sure developers really understand that in normal circumstances they should be firing the onDidClose event. Since /**
* Make onDidClose required for tasks so developers realize they should
* implement this to have their tasks complete and it is enforced
* by the TypeScript compiler.
* If they want to have a task run forever (which is probably a small case),
* they simply don't fire the event.
*/
export interface TaskPseudoterminal extends Pseudoterminal {
onDidClose: Event<void | number>;
}
/**
* Class used to execute an extension callback as a task.
*/
export class CustomExecution2 {
/**
* @param process The [Pseudoterminal](#Pseudoterminal) to be used by the task to display output.
* @param callback The callback that will be called when the task is started by a user.
*/
constructor(callback: () => Thenable<TaskPseudoterminal>);
/**
* The callback used to execute the task. Cancellation should be handled using
* [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
* [Pseudoterminal.onDidClose](#PseudoterminalForTask.onDidClose).
*/
callback: () => Thenable<TaskPseudoterminal>;
} |
One final note: If an extension fires onDidClose, will close get called? Vice versa is also a question, if close is called, should onDidClose be called? |
@Tyriar for the intended behavior around |
Since we still have more to discuss for this API we'll continue in October. Leaving the Milestone as September for now though so we don't forget to keep discussing it. |
My thoughts on making |
This is by design, if you read close's comment carefully it hints at this:
👎 to making |
This will work for us, it will be a huge benefit. I would support coming up with some simplified examples somewhere as the CustomExecution+PseudoTerminal is significantly more complicated than ShellExecution/ProcessExecution are. The only thing we really want in addition is #2809, an API to resolve task variables; but this can come later. |
The task provider extension sample has an example of how to use CustomExecution: https://github.com/microsoft/vscode-extension-samples/tree/master/task-provider-sample |
and update documentation for it. Part of #80375
No description provided.
The text was updated successfully, but these errors were encountered: