diff --git a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts index a68f0487ebe05..70d698873f82c 100644 --- a/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts +++ b/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts @@ -391,10 +391,11 @@ export class CommandDetectionCapability extends Disposable implements ICommandDe if (newCommand) { this._commands.push(newCommand); this._onBeforeCommandFinished.fire(newCommand); - if (!this._currentCommand.isInvalid) { - this._logService.debug('CommandDetectionCapability#onCommandFinished', newCommand); - this._onCommandFinished.fire(newCommand); - } + // NOTE: onCommandFinished used to not fire if the command was invalid, but this causes + // problems especially with the associated execution event never firing in the extension + // API. See https://github.com/microsoft/vscode/issues/252489 + this._logService.debug('CommandDetectionCapability#onCommandFinished', newCommand); + this._onCommandFinished.fire(newCommand); } this._currentCommand = new PartialTerminalCommand(this._terminal); this._handleCommandStartOptions = undefined;