Skip to content

Commit b08d5c6

Browse files
authored
Fix empty diff editor, leakage, and duplicated labels (microsoft#213994)
Store/dispose a reference to the RHS model of the compare editor instead of the model, make sure diff editors are released, fix repeated labels fixes microsoft/vscode-copilot#5885 fixes microsoft#213992
1 parent 6ebb2c9 commit b08d5c6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,8 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
10711071
URI.from({ scheme: Schemas.vscodeChatCodeBlock, path: original.uri.path, query: generateUuid() }),
10721072
false
10731073
);
1074-
store.add(modified);
1074+
const modRef = await this.textModelService.createModelReference(modified.uri);
1075+
store.add(modRef);
10751076

10761077
const editGroups: ISingleEditOperation[][] = [];
10771078
if (isResponseVM(element)) {
@@ -1113,6 +1114,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
11131114
element: ref.object.element,
11141115
dispose() {
11151116
store.dispose();
1117+
ref.dispose();
11161118
},
11171119
};
11181120
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ export class CodeCompareBlockPart extends Disposable {
690690
this.layout(width);
691691
this.diffEditor.updateOptions({ ariaLabel: localize('chat.compareCodeBlockLabel', "Code Edits") });
692692

693+
this.toolbar1.clear();
693694
this.toolbar1.push(toAction({
694695
label: basename(data.edit.uri),
695696
tooltip: localize('chat.edit.tooltip', "Open '{0}'", this.labelService.getUriLabel(data.edit.uri, { relative: true })),

0 commit comments

Comments
 (0)