🚸 stop button for streaming diffs

This commit is contained in:
Nate Sesti 2024-01-30 19:36:37 -08:00
parent 057111ceb9
commit bb582f86b0
3 changed files with 38 additions and 10 deletions

View file

@ -80,7 +80,8 @@
"command": "continue.rejectDiff",
"category": "Continue",
"title": "Reject Diff",
"group": "Continue"
"group": "Continue",
"icon": "$(stop)"
},
{
"command": "continue.quickEdit",
@ -261,6 +262,13 @@
"group": "0_acontinue"
}
],
"editor/title/run": [
{
"command": "continue.rejectDiff",
"group": "Continue",
"when": "continue.streamingDiff"
}
],
"continue.continueSubMenu": [
{
"command": "continue.focusContinueInputWithoutClear",

View file

@ -342,12 +342,18 @@ async function recordAcceptReject(accepted: boolean, diffInfo: DiffInfo) {
);
}
export async function acceptDiffCommand(newFilepath?: string) {
export async function acceptDiffCommand(newFilepath?: string | vscode.Uri) {
if (newFilepath instanceof vscode.Uri) {
newFilepath = newFilepath.fsPath;
}
verticalPerLineDiffManager.clearForFilepath(newFilepath, true);
await diffManager.acceptDiff(newFilepath);
}
export async function rejectDiffCommand(newFilepath?: string) {
export async function rejectDiffCommand(newFilepath?: string | vscode.Uri) {
if (newFilepath instanceof vscode.Uri) {
newFilepath = newFilepath.fsPath;
}
verticalPerLineDiffManager.clearForFilepath(newFilepath, false);
await diffManager.rejectDiff(newFilepath);
}

View file

@ -108,14 +108,28 @@ export async function streamEdit(input: string) {
editor.selection.active
);
await diffHandler.run(
streamDiffLines(
rangeContent,
llm,
input,
getMarkdownLanguageTagForFile(filepath)
)
vscode.commands.executeCommand(
"setContext",
"continue.streamingDiff",
true
);
try {
await diffHandler.run(
streamDiffLines(
rangeContent,
llm,
input,
getMarkdownLanguageTagForFile(filepath)
)
);
} finally {
vscode.commands.executeCommand(
"setContext",
"continue.streamingDiff",
false
);
}
}
}