add editOutcome to schema, and track streamId per file
This commit is contained in:
parent
6d9f566c4c
commit
965e5d554e
4 changed files with 26 additions and 19 deletions
|
|
@ -29,6 +29,11 @@ export async function processDiff(
|
|||
|
||||
await ide.openFile(newOrCurrentUri);
|
||||
|
||||
// If streamId is not provided, try to get it from the VerticalDiffManager
|
||||
if (!streamId) {
|
||||
streamId = verticalDiffManager.getStreamIdForFile(newOrCurrentUri);
|
||||
}
|
||||
|
||||
// Clear vertical diffs depending on action
|
||||
verticalDiffManager.clearForfileUri(newOrCurrentUri, action === "accept");
|
||||
if (action === "reject") {
|
||||
|
|
@ -43,7 +48,7 @@ export async function processDiff(
|
|||
await EditOutcomeTracker.getInstance().recordEditOutcome(
|
||||
streamId,
|
||||
action === "accept",
|
||||
DataLogger.getInstance()
|
||||
DataLogger.getInstance(),
|
||||
);
|
||||
|
||||
await sidebar.webviewProtocol.request("updateApplyState", {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import {
|
|||
indexDecorationType,
|
||||
} from "./decorations";
|
||||
|
||||
import type { VerticalDiffCodeLens } from "./manager";
|
||||
import type { ApplyState, DiffLine } from "core";
|
||||
import type { VerticalDiffCodeLens } from "./manager";
|
||||
|
||||
export interface VerticalDiffHandlerOptions {
|
||||
input?: string;
|
||||
|
|
@ -20,10 +20,12 @@ export interface VerticalDiffHandlerOptions {
|
|||
numDiffs?: ApplyState["numDiffs"],
|
||||
fileContent?: ApplyState["fileContent"],
|
||||
) => void;
|
||||
streamId?: string;
|
||||
}
|
||||
|
||||
export class VerticalDiffHandler implements vscode.Disposable {
|
||||
public insertedInCurrentBlock = 0;
|
||||
public streamId?: string;
|
||||
disposables: vscode.Disposable[] = [];
|
||||
private currentLineIndex: number;
|
||||
private cancelled = false;
|
||||
|
|
@ -50,6 +52,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
public options: VerticalDiffHandlerOptions,
|
||||
) {
|
||||
this.currentLineIndex = startLine;
|
||||
this.streamId = options.streamId;
|
||||
|
||||
this.removedLineDecorations = new RemovedLineDecorationManager(this.editor);
|
||||
this.addedLineDecorations = new AddedLineDecorationManager(this.editor);
|
||||
|
|
@ -330,10 +333,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
// Then, we insert our diff lines
|
||||
await this.editor.edit((editBuilder) => {
|
||||
editBuilder.replace(this.range, replaceContent),
|
||||
{
|
||||
undoStopAfter: false,
|
||||
undoStopBefore: false,
|
||||
};
|
||||
{ undoStopAfter: false, undoStopBefore: false };
|
||||
});
|
||||
|
||||
// Lastly, we apply decorations
|
||||
|
|
@ -446,10 +446,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
editBuilder.insert(new vscode.Position(index, 0), `${text}\n`);
|
||||
}
|
||||
},
|
||||
{
|
||||
undoStopAfter: false,
|
||||
undoStopBefore: false,
|
||||
},
|
||||
{ undoStopAfter: false, undoStopBefore: false },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -467,10 +464,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
new vscode.Range(startLine, startLine.translate(numLines)),
|
||||
);
|
||||
},
|
||||
{
|
||||
undoStopAfter: false,
|
||||
undoStopBefore: false,
|
||||
},
|
||||
{ undoStopAfter: false, undoStopBefore: false },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -486,10 +480,7 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
undoStopAfter: false,
|
||||
undoStopBefore: false,
|
||||
},
|
||||
{ undoStopAfter: false, undoStopBefore: false },
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ export class VerticalDiffManager {
|
|||
public refreshCodeLens: () => void = () => {};
|
||||
|
||||
private fileUriToHandler: Map<string, VerticalDiffHandler> = new Map();
|
||||
|
||||
fileUriToCodeLens: Map<string, VerticalDiffCodeLens[]> = new Map();
|
||||
|
||||
private userChangeListener: vscode.Disposable | undefined;
|
||||
|
|
@ -69,6 +68,10 @@ export class VerticalDiffManager {
|
|||
return this.fileUriToHandler.get(fileUri);
|
||||
}
|
||||
|
||||
getStreamIdForFile(fileUri: string): string | undefined {
|
||||
return this.fileUriToHandler.get(fileUri)?.streamId;
|
||||
}
|
||||
|
||||
// Creates a listener for document changes by user.
|
||||
private enableDocumentChangeListener(): vscode.Disposable | undefined {
|
||||
if (this.userChangeListener) {
|
||||
|
|
@ -229,6 +232,7 @@ export class VerticalDiffManager {
|
|||
filepath: fileUri,
|
||||
toolCallId,
|
||||
}),
|
||||
streamId,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -373,6 +377,7 @@ export class VerticalDiffManager {
|
|||
filepath: fileUri,
|
||||
toolCallId,
|
||||
}),
|
||||
streamId,
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ import {
|
|||
editInteractionEventSchema_0_2_0,
|
||||
editInteractionEventSchema_0_2_0_noCode,
|
||||
} from "./editInteraction/v0.2.0.js";
|
||||
import {
|
||||
editOutcomeEventSchema_0_2_0,
|
||||
editOutcomeEventSchema_0_2_0_noCode,
|
||||
} from "./editOutcome/v0.2.0.js";
|
||||
import { quickEditEventAllSchema } from "./quickEdit/index.js";
|
||||
import {
|
||||
quickEditEventSchema_0_1_0,
|
||||
|
|
@ -97,6 +101,7 @@ export const devDataVersionedSchemas = {
|
|||
tokensGenerated: tokensGeneratedEventSchema_0_2_0,
|
||||
chatInteraction: chatInteractionEventSchema_0_2_0,
|
||||
editInteraction: editInteractionEventSchema_0_2_0,
|
||||
editOutcome: editOutcomeEventSchema_0_2_0,
|
||||
},
|
||||
noCode: {
|
||||
autocomplete: autocompleteEventSchema_0_2_0_noCode,
|
||||
|
|
@ -104,6 +109,7 @@ export const devDataVersionedSchemas = {
|
|||
tokensGenerated: tokensGeneratedEventSchema_0_2_0_noCode,
|
||||
chatInteraction: chatInteractionEventSchema_0_2_0_noCode,
|
||||
editInteraction: editInteractionEventSchema_0_2_0_noCode,
|
||||
editOutcome: editOutcomeEventSchema_0_2_0_noCode,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue