Skip to content

Commit 30c1b57

Browse files
committed
edits: fix hydrated edits from background sessions missing stops
Core merges seqential markdown blocks together. In normal edits they're broken up by (hidden) tool call parts for edits, but this was not the case for background agents. Simplest change is just making background agent edits work the same way as normal edits by emitting the tool call part. Closes microsoft/vscode#281633
1 parent 758c9c0 commit 30c1b57

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/extension/agents/copilotcli/common/copilotCLITools.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,14 @@ export function buildChatHistoryFromEvents(sessionId: string, events: readonly S
384384
const editId = details?.toolIdEditMap ? details.toolIdEditMap[toolCall.toolCallId] : undefined;
385385
const editedUris = getAffectedUrisForEditTool(toolCall);
386386
if (isCopilotCliEditToolCall(toolCall) && editId && editedUris.length > 0) {
387+
responsePart.presentation = 'hidden';
388+
currentResponseParts.push(responsePart);
387389
for (const uri of editedUris) {
388390
currentResponseParts.push(new ChatResponseMarkdownPart('\n````\n'));
389391
currentResponseParts.push(new ChatResponseCodeblockUriPart(uri, true, editId));
390-
currentResponseParts.push(new ChatResponseMarkdownPart('\n````\n'));
391392
currentResponseParts.push(new ChatResponseTextEditPart(uri, []));
392393
currentResponseParts.push(new ChatResponseTextEditPart(uri, true));
394+
currentResponseParts.push(new ChatResponseMarkdownPart('\n````\n'));
393395
}
394396
} else {
395397
currentResponseParts.push(responsePart);

src/extension/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ declare module 'vscode' {
105105
isComplete?: boolean;
106106
toolSpecificData?: ChatTerminalToolInvocationData;
107107
fromSubAgent?: boolean;
108+
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
108109

109110
constructor(toolName: string, toolCallId: string, isError?: boolean);
110111
}

0 commit comments

Comments
 (0)