From 142e2043b82fbf46af3841f9b07613ab8484dd65 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 4 Jul 2023 11:58:02 -0700 Subject: 3.8 compatibility and deleting context all at once --- extension/src/continueIdeClient.ts | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'extension/src/continueIdeClient.ts') diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 999bca88..c517eb98 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -159,6 +159,9 @@ class IdeProtocolClient { case "showSuggestion": this.showSuggestion(data.edit); break; + case "showDiff": + this.showDiff(data.filepath, data.replacement); + break; case "openGUI": case "connected": break; @@ -236,6 +239,42 @@ class IdeProtocolClient { ); } + contentProvider: vscode.Disposable | null = null; + + showDiff(filepath: string, replacement: string) { + const myProvider = new (class + implements vscode.TextDocumentContentProvider + { + onDidChangeEmitter = new vscode.EventEmitter(); + onDidChange = this.onDidChangeEmitter.event; + provideTextDocumentContent = (uri: vscode.Uri) => { + return replacement; + }; + })(); + this.contentProvider = vscode.workspace.registerTextDocumentContentProvider( + "continueDiff", + myProvider + ); + + // Call the event fire + const diffFilename = `continueDiff://${filepath}`; + myProvider.onDidChangeEmitter.fire(vscode.Uri.parse(diffFilename)); + + const leftUri = vscode.Uri.file(filepath); + const rightUri = vscode.Uri.parse(diffFilename); + const title = "Continue Diff"; + vscode.commands + .executeCommand("vscode.diff", leftUri, rightUri, title) + .then( + () => { + console.log("Diff view opened successfully"); + }, + (error) => { + console.error("Error opening diff view:", error); + } + ); + } + openFile(filepath: string) { // vscode has a builtin open/get open files openEditorAndRevealRange(filepath, undefined, vscode.ViewColumn.One); -- cgit v1.2.3-70-g09d2 From 4c51e14ae8fc19ff1c7552f060a59f21abf016c7 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 4 Jul 2023 13:56:38 -0700 Subject: insert at cursor, patch --- continuedev/src/continuedev/steps/core/core.py | 2 +- extension/package-lock.json | 4 ++-- extension/package.json | 2 +- extension/src/continueIdeClient.ts | 28 +++++++++++++------------- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'extension/src/continueIdeClient.ts') diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py index 4ad47689..b9f0da35 100644 --- a/continuedev/src/continuedev/steps/core/core.py +++ b/continuedev/src/continuedev/steps/core/core.py @@ -174,7 +174,7 @@ class DefaultModelEditCodeStep(Step): name = await models.gpt3516k.complete(f"Write a very short title to describe this requested change (no quotes): '{self.user_input}'. This is the title:") self.name = self._cleanup_output(name) - return f"`{self.user_input}`\n\n{self._cleanup_output(description)}" + return f"{self._cleanup_output(description)}" async def get_prompt_parts(self, rif: RangeInFileWithContents, sdk: ContinueSDK, full_file_contents: str): # We don't know here all of the functions being passed in. diff --git a/extension/package-lock.json b/extension/package-lock.json index 94823004..c4a930de 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.107", + "version": "0.0.108", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.107", + "version": "0.0.108", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 6434efc3..87dd7ba6 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.107", + "version": "0.0.108", "publisher": "Continue", "engines": { "vscode": "^1.67.0" diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index c517eb98..b9969858 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -410,21 +410,21 @@ class IdeProtocolClient { let rangeInFiles: RangeInFile[] = []; vscode.window.visibleTextEditors.forEach((editor) => { editor.selections.forEach((selection) => { - if (!selection.isEmpty) { - rangeInFiles.push({ - filepath: editor.document.uri.fsPath, - range: { - start: { - line: selection.start.line, - character: selection.start.character, - }, - end: { - line: selection.end.line, - character: selection.end.character, - }, + // if (!selection.isEmpty) { + rangeInFiles.push({ + filepath: editor.document.uri.fsPath, + range: { + start: { + line: selection.start.line, + character: selection.start.character, }, - }); - } + end: { + line: selection.end.line, + character: selection.end.character, + }, + }, + }); + // } }); }); return rangeInFiles; -- cgit v1.2.3-70-g09d2