diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 279272208..6134753c7 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -132,6 +132,26 @@ "category": "Continue", "title": "View History", "icon": "$(history)" + }, + { + "command": "continue.writeCommentsForCode", + "category": "Continue", + "title": "Write Comments for this Code" + }, + { + "command": "continue.writeDocstringForCode", + "category": "Continue", + "title": "Write a Docstring for this Code" + }, + { + "command": "continue.fixCode", + "category": "Continue", + "title": "Fix this Code" + }, + { + "command": "continue.optimizeCode", + "category": "Continue", + "title": "Optimize this Code" } ], "keybindings": [ @@ -198,12 +218,27 @@ ], "continue.continueSubMenu": [ { - "command": "continue.focusContinueInput", - "when": "editorHasSelection", - "group": "Continue" + "command": "continue.focusContinueInputWithoutClear", + "group": "Continue", + "when": "editorHasSelection" }, { - "command": "continue.focusContinueInputWithoutClear", + "command": "continue.writeCommentsForCode", + "group": "Continue", + "when": "editorHasSelection" + }, + { + "command": "continue.writeDocstringForCode", + "group": "Continue", + "when": "editorHasSelection" + }, + { + "command": "continue.fixCode", + "group": "Continue", + "when": "editorHasSelection" + }, + { + "command": "continue.optimizeCode", "group": "Continue", "when": "editorHasSelection" } diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 5213f51b6..bb10d1ee8 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -115,6 +115,18 @@ const commandsMap: { [command: string]: (...args: any) => any } = { await streamEdit(text); } }, + "continue.writeCommentsForCode": async () => { + await streamEdit("Write comments for this code"); + }, + "continue.writeDocstringForCode": async () => { + await streamEdit("Write a docstring for this code"); + }, + "continue.fixCode": async () => { + await streamEdit("Fix this code"); + }, + "continue.optimizeCode": async () => { + await streamEdit("Optimize this code"); + }, "continue.viewLogs": async () => { // Open ~/.continue/continue.log const logFile = path.join(os.homedir(), ".continue", "continue.log"); diff --git a/extensions/vscode/src/diff/verticalPerLine.ts b/extensions/vscode/src/diff/verticalPerLine.ts index cceb696aa..8f1f24dd5 100644 --- a/extensions/vscode/src/diff/verticalPerLine.ts +++ b/extensions/vscode/src/diff/verticalPerLine.ts @@ -178,6 +178,10 @@ export class VerticalPerLineDiffHandler { ]); } } + + initialize() { + this.updateIndexLineDecorations(); + } } class VerticalPerLineDiffManager { @@ -257,20 +261,13 @@ export async function streamEdit(input: string) { editor.selection.active ); + diffHandler.initialize(); + for await (const diffLine of streamDiffLines(rangeContent, llm, input)) { if (diffHandler.isCancelled) { break; } - console.log( - (diffLine.type === "new" - ? "+ " - : diffLine.type === "old" - ? "- " - : " ") + diffLine.line - ); await diffHandler.handleDiffLine(diffLine); } } - - // Shortcuts to accept / reject }