From c00cf036f1332b727fbfda3e558ae7140bb9abbc Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 1 Apr 2025 10:50:57 +0200 Subject: [PATCH] more workingSet removal --- .../browser/chatEditing/chatEditingSession.ts | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts b/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts index 18e58467a2f..03d5d2bfc7d 100644 --- a/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts +++ b/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts @@ -416,7 +416,6 @@ export class ChatEditingSession extends Disposable implements IChatEditingSessio return { stopId: undoStop, - workingSet: new ResourceMap(), entries, }; } @@ -467,7 +466,7 @@ export class ChatEditingSession extends Disposable implements IChatEditingSessio } } - private async _restoreSnapshot({ workingSet, entries }: IChatEditingSessionStop, tx: ITransaction | undefined, restoreResolvedToDisk = true): Promise { + private async _restoreSnapshot({ entries }: IChatEditingSessionStop, tx: ITransaction | undefined, restoreResolvedToDisk = true): Promise { // Reset all the files which are modified in this session state // but which are not found in the snapshot @@ -985,12 +984,6 @@ class ChatEditingSessionStorage { } return readPromise; }; - const deserializeResourceMap = (resourceMap: ResourceMapDTO, deserialize: (value: any) => T, result: ResourceMap): ResourceMap => { - resourceMap.forEach(([resourceURI, value]) => { - result.set(URI.parse(resourceURI), deserialize(value)); - }); - return result; - }; const deserializeSnapshotEntriesDTO = async (dtoEntries: ISnapshotEntryDTO[]): Promise> => { const entries = new ResourceMap(); for (const entryDTO of dtoEntries) { @@ -1001,14 +994,13 @@ class ChatEditingSessionStorage { }; const deserializeChatEditingStopDTO = async (stopDTO: IChatEditingSessionStopDTO | IChatEditingSessionSnapshotDTO): Promise => { const entries = await deserializeSnapshotEntriesDTO(stopDTO.entries); - const workingSet = deserializeResourceMap(stopDTO.workingSet, (value) => value, new ResourceMap()); - return { stopId: 'stopId' in stopDTO ? stopDTO.stopId : undefined, workingSet, entries }; + return { stopId: 'stopId' in stopDTO ? stopDTO.stopId : undefined, entries }; }; const normalizeSnapshotDtos = (snapshot: IChatEditingSessionSnapshotDTO | IChatEditingSessionSnapshotDTO2): IChatEditingSessionSnapshotDTO2 => { if ('stops' in snapshot) { return snapshot; } - return { requestId: snapshot.requestId, stops: [{ stopId: undefined, entries: snapshot.entries, workingSet: snapshot.workingSet }], postEdit: undefined }; + return { requestId: snapshot.requestId, stops: [{ stopId: undefined, entries: snapshot.entries }], postEdit: undefined }; }; const deserializeChatEditingSessionSnapshot = async (startIndex: number, snapshot: IChatEditingSessionSnapshotDTO2): Promise => { const stops = await Promise.all(snapshot.stops.map(deserializeChatEditingStopDTO)); @@ -1104,7 +1096,6 @@ class ChatEditingSessionStorage { const serializeChatEditingSessionStop = (stop: IChatEditingSessionStop): IChatEditingSessionStopDTO => { return { stopId: stop.stopId, - workingSet: serializeResourceMap(stop.workingSet, value => value), entries: Array.from(stop.entries.values()).map(serializeSnapshotEntry) }; }; @@ -1190,13 +1181,11 @@ interface IChatEditingSessionStop { /** Edit stop ID, first for a request is always undefined. */ stopId: string | undefined; - readonly workingSet: ResourceMap; readonly entries: ResourceMap; } interface IChatEditingSessionStopDTO { readonly stopId: string | undefined; - readonly workingSet: ResourceMapDTO; readonly entries: ISnapshotEntryDTO[]; }