From b67950c9212d48c93712c73fd28ecd239fad3651 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Thu, 26 Mar 2026 15:48:32 +1100 Subject: [PATCH] Improve terminal output handling to hide output when not required --- .../chatTerminalToolProgressPart.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts index da42cf8d77b00..a6dc8a4718ee8 100644 --- a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts +++ b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts @@ -360,8 +360,13 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart () => this._terminalData.terminalCommandOutput, () => this._commandText, () => this._terminalData.terminalTheme, + !!this._terminalData.terminalToolSessionId, )); - elements.container.append(this._outputView.domNode); + // Only append the output section if there's a terminal session or stored output; + // display-only invocations with no output don't need the output area at all + if (this._terminalData.terminalToolSessionId || this._terminalData.terminalCommandOutput) { + elements.container.append(this._outputView.domNode); + } this._register(this._outputView.onDidFocus(() => this._handleOutputFocus())); this._register(this._outputView.onDidBlur(e => this._handleOutputBlur(e))); this._register(toDisposable(() => this._handleDispose())); @@ -1039,6 +1044,7 @@ class ChatTerminalToolOutputSection extends Disposable { private readonly _getTerminalCommandOutput: () => IChatTerminalToolInvocationData['terminalCommandOutput'] | undefined, private readonly _getCommandText: () => string, private readonly _getStoredTheme: () => IChatTerminalToolInvocationData['terminalTheme'] | undefined, + private readonly _hasTerminalSession: boolean, @IAccessibleViewService private readonly _accessibleViewService: IAccessibleViewService, @IInstantiationService private readonly _instantiationService: IInstantiationService, @ITerminalConfigurationService private readonly _terminalConfigurationService: ITerminalConfigurationService, @@ -1219,6 +1225,10 @@ class ChatTerminalToolOutputSection extends Disposable { return; } + if (!this._hasTerminalSession) { + return; + } + this._renderUnavailableMessage(liveTerminalInstance); }