diff --git a/core/nextEdit/context/processNextEditData.ts b/core/nextEdit/context/processNextEditData.ts index 7f25fa170..206b17b80 100644 --- a/core/nextEdit/context/processNextEditData.ts +++ b/core/nextEdit/context/processNextEditData.ts @@ -108,19 +108,22 @@ export const processNextEditData = async ({ ); } - void DataLogger.getInstance().logDevData({ - name: "nextEditWithHistory", - data: { - previousEdits: filenamesAndDiffs, - fileURI: filePath, - workspaceDirURI: workspaceDir, - beforeContent, - afterContent, - beforeCursorPos: cursorPosBeforeEdit, - afterCursorPos: cursorPosAfterPrevEdit, - context: autocompleteContext, - }, - }); + if (filenamesAndDiffs.length > 0) { + // if there are previous edits, log + void DataLogger.getInstance().logDevData({ + name: "nextEditWithHistory", + data: { + previousEdits: filenamesAndDiffs, + fileURI: filePath, + workspaceDirURI: workspaceDir, + beforeContent, + afterContent, + beforeCursorPos: cursorPosBeforeEdit, + afterCursorPos: cursorPosAfterPrevEdit, + context: autocompleteContext, + }, + }); + } // add current edit to history const thisEdit: prevEdit = { diff --git a/packages/config-yaml/src/schemas/data/index.ts b/packages/config-yaml/src/schemas/data/index.ts index 57c820ab3..d3738ec69 100644 --- a/packages/config-yaml/src/schemas/data/index.ts +++ b/packages/config-yaml/src/schemas/data/index.ts @@ -33,11 +33,11 @@ import { editOutcomeEventSchema_0_2_0, editOutcomeEventSchema_0_2_0_noCode, } from "./editOutcome/v0.2.0.js"; -import { nextEditEventAllSchema } from "./nextEdit/index.js"; +import { nextEditEventAllSchema } from "./nextEditWithHistory/index.js"; import { nextEditEventSchema_0_2_0, nextEditEventSchema_0_2_0_noCode, -} from "./nextEdit/v0.2.0.js"; +} from "./nextEditWithHistory/v0.2.0.js"; import { quickEditEventAllSchema } from "./quickEdit/index.js"; import { quickEditEventSchema_0_1_0, @@ -88,7 +88,7 @@ const devEventAllVersionDataSchemas = z.object({ chatInteraction: chatInteractionEventAllSchema, editInteraction: editInteractionEventAllSchema, editOutcome: editOutcomeEventAllSchema, - nextEdit: nextEditEventAllSchema, + nextEditWithHistory: nextEditEventAllSchema, toolUsage: toolUsageEventAllSchema, }); @@ -116,7 +116,7 @@ export const devDataVersionedSchemas = { chatInteraction: chatInteractionEventSchema_0_2_0, editInteraction: editInteractionEventSchema_0_2_0, editOutcome: editOutcomeEventSchema_0_2_0, - nextEdit: nextEditEventSchema_0_2_0, + nextEditWithHistory: nextEditEventSchema_0_2_0, toolUsage: toolUsageEventSchema_0_2_0, }, noCode: { @@ -126,7 +126,7 @@ export const devDataVersionedSchemas = { chatInteraction: chatInteractionEventSchema_0_2_0_noCode, editInteraction: editInteractionEventSchema_0_2_0_noCode, editOutcome: editOutcomeEventSchema_0_2_0_noCode, - nextEdit: nextEditEventSchema_0_2_0_noCode, + nextEditWithHistory: nextEditEventSchema_0_2_0_noCode, toolUsage: toolUsageEventSchema_0_2_0_noCode, }, }, diff --git a/packages/config-yaml/src/schemas/data/nextEdit/index.ts b/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts similarity index 80% rename from packages/config-yaml/src/schemas/data/nextEdit/index.ts rename to packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts index de2607e5c..16f4a1746 100644 --- a/packages/config-yaml/src/schemas/data/nextEdit/index.ts +++ b/packages/config-yaml/src/schemas/data/nextEditWithHistory/index.ts @@ -2,6 +2,12 @@ import { z } from "zod"; import { baseDevDataAllSchema } from "../base.js"; export const nextEditEventAllSchema = baseDevDataAllSchema.extend({ + previousEdits: z.array( + z.object({ + filename: z.string(), + diff: z.string(), + }), + ), fileURI: z.string(), workspaceDirURI: z.string(), beforeContent: z.string(), diff --git a/packages/config-yaml/src/schemas/data/nextEdit/v0.2.0.ts b/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts similarity index 93% rename from packages/config-yaml/src/schemas/data/nextEdit/v0.2.0.ts rename to packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts index 3c95d4e3c..ec2e6bb80 100644 --- a/packages/config-yaml/src/schemas/data/nextEdit/v0.2.0.ts +++ b/packages/config-yaml/src/schemas/data/nextEditWithHistory/v0.2.0.ts @@ -10,6 +10,7 @@ export const nextEditEventSchema_0_2_0 = nextEditEventAllSchema.pick({ schema: true, // nextedit-specific + previousEdits: true, fileURI: true, workspaceDirURI: true, beforeContent: true, @@ -20,6 +21,7 @@ export const nextEditEventSchema_0_2_0 = nextEditEventAllSchema.pick({ }); export const nextEditEventSchema_0_2_0_noCode = nextEditEventSchema_0_2_0.omit({ + previousEdits: true, fileURI: true, workspaceDirURI: true, beforeContent: true,