-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Adopt virtual process terminals in task custom execution API #76492
Comments
/**
* Class used to execute an extension callback as a task.
*/
export class CustomExecution2 {
/**
* @param process The [TerminalVirtualProcess](#TerminalVirtualProcess) 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(process: TerminalVirtualProcess, callback: (thisArg?: any) => Thenable<void>);
/**
* The callback used to execute the task. Cancellation should be handled using the [TerminalVirtualProcess](#TerminalVirtualProcess).
* When the task is complete, onDidExit should be fired on the TerminalVirtualProcess with the exit code with '0' for success and a non-zero value for failure.
*/
callback: (thisArg?: any) => Thenable<void>;
/**
* The [TerminalVirtualProcess](#TerminalVirtualProcess) will be attached to a terminal when the task is started.
* At that point it can be used to show output and accept input. process.shutdown() should be implemented to handle interruption of the task
*/
process: TerminalVirtualProcess;
} |
Updated API: /**
* Class used to execute an extension callback as a task.
*/
export class CustomExecution2 {
/**
* @param process The [TerminalVirtualProcess](#TerminalVirtualProcess) 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: (thisArg?: any) => Thenable<TerminalVirtualProcess>);
/**
* The callback used to execute the task. Cancellation should be handled using the shutdown method of [TerminalVirtualProcess](#TerminalVirtualProcess).
* When the task is complete, onDidExit should be fired on the TerminalVirtualProcess with the exit code with '0' for success and a non-zero value for failure.
*/
callback: (thisArg?: any) => Thenable<TerminalVirtualProcess>;
} This also requires a const execution = new vscode.CustomExecution2(
async (): Promise<vscode.TerminalVirtualProcess> => {
return new TestTerminalProcess();
});
...
class TestTerminalProcess implements vscode.TerminalVirtualProcess {
private writeEmitter = new vscode.EventEmitter<string>();
onDidWrite = this.writeEmitter.event;
private exitEmitter = new vscode.EventEmitter<number>();
onDidExit = this.exitEmitter.event;
constructor() {
// Can't start emitting things here, no one is listening.
}
start() {
this.writeEmitter.fire('Hello, terminal');
setTimeout(() => {
this.writeEmitter.fire('Goodbye!');
this.exitEmitter.fire(0);
}, 3000);
}
shutdown() {
console.log("Shutting down");
}
input(data: string): void {
console.log('There was input');
}
setDimensions?(dimensions: vscode.TerminalDimensions): void {
console.log('Dims changed');
}
} I've added the |
alexr00
added a commit
that referenced
this issue
Jul 10, 2019
* Adopt TerminalVirtualProcess for Custom task execution * Update Custom task execution API to return TerminalVirtualProcess in callback This also required the addtion of a start on the virtual terminal process * Clarify start API Fixes #76492
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Implemented in #70978
There's a proposal for how it would work there.
The text was updated successfully, but these errors were encountered: