Skip to content

Commit 096c9b7

Browse files
justschenCopilot
andauthored
simple terminal tools on surface level of chat (#296870)
* simple terminal tools on surface level of chat * Set SimpleTerminalCollapsible default true for Insiders, false for Stable (#296911) * Initial plan * Set SimpleTerminalCollapsible default true for insiders, false for stable Co-authored-by: justschen <54879025+justschen@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: justschen <54879025+justschen@users.noreply.github.com> * make sure it is initialized the right way --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent 158c590 commit 096c9b7

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,12 @@ configurationRegistry.registerConfiguration({
11291129
markdownDescription: nls.localize('chat.agent.thinking.terminalTools', "When enabled, terminal tool calls are displayed inside the thinking dropdown with a simplified view."),
11301130
tags: ['experimental'],
11311131
},
1132+
[ChatConfiguration.SimpleTerminalCollapsible]: {
1133+
type: 'boolean',
1134+
default: product.quality !== 'stable',
1135+
markdownDescription: nls.localize('chat.tools.terminal.simpleCollapsible', "When enabled, terminal tool calls are always displayed in a collapsible container with a simplified view."),
1136+
tags: ['experimental'],
1137+
},
11321138
'chat.tools.usagesTool.enabled': {
11331139
type: 'boolean',
11341140
default: true,

src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart
222222
private readonly _decoration: TerminalCommandDecoration;
223223
private _userToggledOutput: boolean = false;
224224
private _isInThinkingContainer: boolean = false;
225+
private _usesCollapsibleWrapper: boolean = false;
225226
private _thinkingCollapsibleWrapper: ChatTerminalThinkingCollapsibleWrapper | undefined;
226227

227228
private markdownPart: ChatMarkdownContentPart | undefined;
@@ -360,12 +361,14 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart
360361
const progressPart = this._register(_instantiationService.createInstance(ChatProgressSubPart, elements.container, this.getIcon(), terminalData.autoApproveInfo));
361362
this._decoration.update();
362363

363-
// wrap terminal when thinking setting enabled
364+
// Keep thinking-container semantics separate from wrapper semantics.
364365
const terminalToolsInThinking = this._configurationService.getValue<boolean>(ChatConfiguration.TerminalToolsInThinking);
366+
const isSimpleTerminal = this._configurationService.getValue<boolean>(ChatConfiguration.SimpleTerminalCollapsible);
365367
const requiresConfirmation = toolInvocation.kind === 'toolInvocation' && IChatToolInvocation.getConfirmationMessages(toolInvocation);
368+
this._isInThinkingContainer = terminalToolsInThinking && !requiresConfirmation;
369+
this._usesCollapsibleWrapper = this._isInThinkingContainer || isSimpleTerminal;
366370

367-
if (terminalToolsInThinking && !requiresConfirmation) {
368-
this._isInThinkingContainer = true;
371+
if (this._usesCollapsibleWrapper) {
369372
this.domNode = this._createCollapsibleWrapper(progressPart.domNode, displayCommand, toolInvocation, context);
370373
} else {
371374
this.domNode = progressPart.domNode;
@@ -520,8 +523,8 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart
520523
if (this._store.isDisposed) {
521524
return;
522525
}
523-
// don't show dropdown when in thinking container
524-
if (this._isInThinkingContainer) {
526+
// don't show dropdown when rendered with the simplified/collapsible wrapper
527+
if (this._usesCollapsibleWrapper) {
525528
return;
526529
}
527530
const resolvedCommand = command ?? this._getResolvedCommand();
@@ -624,7 +627,7 @@ export class ChatTerminalToolProgressPart extends BaseChatToolInvocationSubPart
624627
hasRealOutput,
625628
}));
626629
store.add(autoExpand.onDidRequestExpand(() => {
627-
if (this._isInThinkingContainer) {
630+
if (this._usesCollapsibleWrapper) {
628631
this.expandCollapsibleWrapper();
629632
}
630633
this._toggleOutput(true);

src/vs/workbench/contrib/chat/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export enum ChatConfiguration {
3737
ThinkingStyle = 'chat.agent.thinkingStyle',
3838
ThinkingGenerateTitles = 'chat.agent.thinking.generateTitles',
3939
TerminalToolsInThinking = 'chat.agent.thinking.terminalTools',
40+
SimpleTerminalCollapsible = 'chat.tools.terminal.simpleCollapsible',
4041
ThinkingPhrases = 'chat.agent.thinking.phrases',
4142
AutoExpandToolFailures = 'chat.tools.autoExpandFailures',
4243
TodosShowWidget = 'chat.tools.todos.showWidget',

0 commit comments

Comments
 (0)