Fix empty diff editor, leakage, and duplicated labels (#213993)

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 https://github.com/microsoft/vscode-copilot/issues/5885
fixes https://github.com/microsoft/vscode/issues/213992
This commit is contained in:
Johannes Rieken 2024-05-31 13:09:31 +02:00 committed by GitHub
parent 573dc3dcf4
commit 0e9d31e17d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -1071,7 +1071,8 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
URI.from({ scheme: Schemas.vscodeChatCodeBlock, path: original.uri.path, query: generateUuid() }),
false
);
store.add(modified);
const modRef = await this.textModelService.createModelReference(modified.uri);
store.add(modRef);
const editGroups: ISingleEditOperation[][] = [];
if (isResponseVM(element)) {
@ -1113,6 +1114,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
element: ref.object.element,
dispose() {
store.dispose();
ref.dispose();
},
};
}

View file

@ -690,6 +690,7 @@ export class CodeCompareBlockPart extends Disposable {
this.layout(width);
this.diffEditor.updateOptions({ ariaLabel: localize('chat.compareCodeBlockLabel', "Code Edits") });
this.toolbar1.clear();
this.toolbar1.push(toAction({
label: basename(data.edit.uri),
tooltip: localize('chat.edit.tooltip', "Open '{0}'", this.labelService.getUriLabel(data.edit.uri, { relative: true })),