diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 488b4e077dd32e959227ce7468f1657a06b2da22..8a6c2307d02baaf2aac9405355e590ea002cdae2 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -6123,9 +6123,10 @@ declare module 'vscode' { * [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire * [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose). * @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. + * @param callback The callback that will be called when the task is started by a user. Any ${} style variables that + * were in the task definition will be resolved and passed into the callback. */ - constructor(callback: () => Thenable); + constructor(callback: (resolvedDefinition: TaskDefinition) => Thenable); } /** diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index c240f250bb4c03005f99fd7ff09c747ce3645885..cab19daf4c15f5a2b7f4bc3c3efef5fb976db84f 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -981,7 +981,6 @@ declare module 'vscode' { } //#endregion - //#region CustomExecution: https://github.com/microsoft/vscode/issues/81007 /** * A task to execute */ @@ -989,19 +988,6 @@ declare module 'vscode' { detail?: string; } - export class CustomExecution2 extends CustomExecution { - /** - * Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the - * extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until - * [Pseudoterminal.open](#Pseudoterminal.open) is called. Task cancellation should be handled using - * [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire - * [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose). - * @param callback The callback that will be called when the task is started by a user. - */ - constructor(callback: (resolvedDefinition: TaskDefinition) => Thenable); - } - //#endregion - //#region Task presentation group: https://github.com/microsoft/vscode/issues/47265 export interface TaskPresentationOptions { /** diff --git a/src/vs/workbench/api/browser/mainThreadTask.ts b/src/vs/workbench/api/browser/mainThreadTask.ts index 6b25a273488937b1cd5ea744c6b3ad53ccf143d2..350ce8e87534fecb151c4f31fb5574562591a975 100644 --- a/src/vs/workbench/api/browser/mainThreadTask.ts +++ b/src/vs/workbench/api/browser/mainThreadTask.ts @@ -418,8 +418,8 @@ export class MainThreadTask implements MainThreadTaskShape { const task = event.__task!; if (event.kind === TaskEventKind.Start) { const execution = TaskExecutionDTO.from(task.getTaskExecution()); - let resolvedDefinition: TaskDefinitionDTO | undefined; - if (execution.task && execution.task.execution && CustomExecutionDTO.is(execution.task.execution) && event.resolvedVariables) { + let resolvedDefinition: TaskDefinitionDTO = execution.task!.definition; + if (execution.task?.execution && CustomExecutionDTO.is(execution.task.execution) && event.resolvedVariables) { const dictionary: IStringDictionary = {}; Array.from(event.resolvedVariables.entries()).forEach(entry => dictionary[entry[0]] = entry[1]); resolvedDefinition = await this._configurationResolverService.resolveAny(task.getWorkspaceFolder(), diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index f697d498e35a28d9d0a50f7b637a287b42f0b44d..314ef18f9020d1279bd2698b2fd5d07d062c1d97 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1039,7 +1039,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I ExtensionMode: extHostTypes.ExtensionMode, ExtensionRuntime: extHostTypes.ExtensionRuntime, CustomExecution: extHostTypes.CustomExecution, - CustomExecution2: extHostTypes.CustomExecution, FileChangeType: extHostTypes.FileChangeType, FileSystemError: extHostTypes.FileSystemError, FileType: files.FileType, diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 512dbb8d5bcde2fb9b0142fdb842b27bf2d0aa5a..391a80730a7566a410f389720864beedda8ea926 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1449,7 +1449,7 @@ export interface ExtHostSCMShape { export interface ExtHostTaskShape { $provideTasks(handle: number, validTypes: { [key: string]: boolean; }): Thenable; $resolveTask(handle: number, taskDTO: tasks.TaskDTO): Thenable; - $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition?: tasks.TaskDefinitionDTO): void; + $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): void; $onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): void; $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): void; $OnDidEndTask(execution: tasks.TaskExecutionDTO): void; diff --git a/src/vs/workbench/api/common/extHostTask.ts b/src/vs/workbench/api/common/extHostTask.ts index f77a8626067423904aa532bf9037ec85a1a9ec5b..cb118977cbd9030160fbdddfb7243b7b2207dd9f 100644 --- a/src/vs/workbench/api/common/extHostTask.ts +++ b/src/vs/workbench/api/common/extHostTask.ts @@ -475,7 +475,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape, IExtHostTask return this._onDidExecuteTask.event; } - public async $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition?: tasks.TaskDefinitionDTO): Promise { + public async $onDidStartTask(execution: tasks.TaskExecutionDTO, terminalId: number, resolvedDefinition: tasks.TaskDefinitionDTO): Promise { const customExecution: types.CustomExecution | undefined = this._providedCustomExecutions2.get(execution.id); if (customExecution) { if (this._activeCustomExecutions2.get(execution.id) !== undefined) { diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index db91ee1e124e350526143e68241e34c486a606f9..5d6b6dc15a2856a518bafdcae4b973c91e072ff2 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -1831,20 +1831,20 @@ export enum TaskScope { Workspace = 2 } -export class CustomExecution implements vscode.CustomExecution2 { - private _callback: (resolvedDefintion?: vscode.TaskDefinition) => Thenable; - constructor(callback: (resolvedDefintion?: vscode.TaskDefinition) => Thenable) { +export class CustomExecution implements vscode.CustomExecution { + private _callback: (resolvedDefintion: vscode.TaskDefinition) => Thenable; + constructor(callback: (resolvedDefintion: vscode.TaskDefinition) => Thenable) { this._callback = callback; } public computeId(): string { return 'customExecution' + generateUuid(); } - public set callback(value: (resolvedDefintion?: vscode.TaskDefinition) => Thenable) { + public set callback(value: (resolvedDefintion: vscode.TaskDefinition) => Thenable) { this._callback = value; } - public get callback(): ((resolvedDefintion?: vscode.TaskDefinition) => Thenable) { + public get callback(): ((resolvedDefintion: vscode.TaskDefinition) => Thenable) { return this._callback; } }