From b31e686b9a54dd4c459898b106bf9f80a897978c Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 3 Nov 2025 17:18:19 -0500 Subject: [PATCH] still show focus action even if no `command` so it's available for basic, none execute strategies (#274893) fixes #274876 --- .../chatTerminalToolProgressPart.ts | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts b/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts index 3aca93d8b8c..e327624d673 100644 --- a/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts +++ b/src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts @@ -199,19 +199,17 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart const actionBar = this._actionBar.value; const isTerminalHidden = this._terminalChatService.isBackgroundTerminal(terminalToolSessionId); const command = this._getResolvedCommand(terminalInstance); - if (command) { - const existingFocus = this._focusAction.value; - if (existingFocus) { - const existingIndex = actionBar.viewItems.findIndex(item => item.action === existingFocus); - if (existingIndex >= 0) { - actionBar.pull(existingIndex); - } + const existingFocus = this._focusAction.value; + if (existingFocus) { + const existingIndex = actionBar.viewItems.findIndex(item => item.action === existingFocus); + if (existingIndex >= 0) { + actionBar.pull(existingIndex); } - const focusAction = this._instantiationService.createInstance(FocusChatInstanceAction, terminalInstance, command, isTerminalHidden); - this._focusAction.value = focusAction; - actionBar.push(focusAction, { icon: true, label: false, index: 0 }); - this._ensureShowOutputAction(); } + const focusAction = this._instantiationService.createInstance(FocusChatInstanceAction, terminalInstance, command, isTerminalHidden); + this._focusAction.value = focusAction; + actionBar.push(focusAction, { icon: true, label: false, index: 0 }); + this._ensureShowOutputAction(); } private _ensureShowOutputAction(): void { @@ -262,9 +260,7 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart const commandDetectionListener = this._register(new MutableDisposable()); const tryResolveCommand = async (): Promise => { const resolvedCommand = this._resolveCommand(terminalInstance); - if (resolvedCommand?.endMarker) { - await this._addActions(terminalInstance, this._terminalData.terminalToolSessionId!); - } + await this._addActions(terminalInstance, this._terminalData.terminalToolSessionId!); return resolvedCommand; }; @@ -544,7 +540,7 @@ class ToggleChatTerminalOutputAction extends Action implements IAction { export class FocusChatInstanceAction extends Action implements IAction { constructor( private readonly _instance: ITerminalInstance, - private readonly _command: ITerminalCommand, + private readonly _command: ITerminalCommand | undefined, isTerminalHidden: boolean, @ITerminalService private readonly _terminalService: ITerminalService, @ITerminalEditorService private readonly _terminalEditorService: ITerminalEditorService, @@ -568,6 +564,8 @@ export class FocusChatInstanceAction extends Action implements IAction { } this._terminalService.setActiveInstance(this._instance); await this._instance?.focusWhenReady(true); - this._instance.xterm?.markTracker.revealCommand(this._command); + if (this._command) { + this._instance.xterm?.markTracker.revealCommand(this._command); + } } }