From ee02bbaa82c012db5e83b1bc9f63e7708a7d1988 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Fri, 11 Jul 2025 11:41:23 -0400 Subject: [PATCH] modify the right arg (#255244) --- .../workbench/api/common/extHost.api.impl.ts | 19 +++++++++++++------ ...vscode.proposed.taskExecutionTerminal.d.ts | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 0f44ca6f3c1..fa91d4b6049 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1357,13 +1357,20 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I get taskExecutions(): vscode.TaskExecution[] { return extHostTask.taskExecutions; }, - onDidStartTask: (listeners, thisArgs?, disposables?) => { - if (!isProposedApiEnabled(extension, 'taskExecutionTerminal')) { - if (thisArgs) { - thisArgs.terminal = undefined; + onDidStartTask: (listener: (e: vscode.TaskStartEvent) => any, thisArgs?: any, disposables?) => { + const wrappedListener = (event: vscode.TaskStartEvent) => { + if (!isProposedApiEnabled(extension, 'taskExecutionTerminal')) { + if (event?.execution?.terminal !== undefined) { + event.execution.terminal = undefined; + } } - } - return _asExtensionEvent(extHostTask.onDidStartTask)(listeners, thisArgs, disposables); + const eventWithExecution = { + ...event, + execution: event.execution + }; + return listener.call(thisArgs, eventWithExecution); + }; + return _asExtensionEvent(extHostTask.onDidStartTask)(wrappedListener, thisArgs, disposables); }, onDidEndTask: (listeners, thisArgs?, disposables?) => { return _asExtensionEvent(extHostTask.onDidEndTask)(listeners, thisArgs, disposables); diff --git a/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts b/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts index a0884721146..24912b369fb 100644 --- a/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts +++ b/src/vscode-dts/vscode.proposed.taskExecutionTerminal.d.ts @@ -10,6 +10,6 @@ declare module 'vscode' { /** * The terminal associated with this task execution, if any. */ - readonly terminal?: Terminal; + terminal?: Terminal; } }