diff options
author | Ty Dunn <ty@tydunn.com> | 2023-07-07 17:57:45 -0700 |
---|---|---|
committer | Ty Dunn <ty@tydunn.com> | 2023-07-07 17:57:45 -0700 |
commit | 59dc2a776268da2567aad17421053011c1263cf1 (patch) | |
tree | de906c1202c72a8008cdee405a489c08bb4e3b85 /extension | |
parent | 128e5b5cf46dee72f6f72b3f36adb83b13dcc0d8 (diff) | |
parent | 4d3a10c0324e451b6481104fcaff47e80ce5db70 (diff) | |
download | sncontinue-59dc2a776268da2567aad17421053011c1263cf1.tar.gz sncontinue-59dc2a776268da2567aad17421053011c1263cf1.tar.bz2 sncontinue-59dc2a776268da2567aad17421053011c1263cf1.zip |
Merge branch 'main' of github.com:continuedev/continue
Diffstat (limited to 'extension')
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 6 | ||||
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 7 | ||||
-rw-r--r-- | extension/react-app/src/tabs/gui.tsx | 10 | ||||
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 4 | ||||
-rw-r--r-- | extension/src/continueIdeClient.ts | 10 | ||||
-rw-r--r-- | extension/src/diffs.ts | 22 |
7 files changed, 35 insertions, 28 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json index 7b1ad703..043f0892 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.118", + "version": "0.0.125", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.118", + "version": "0.0.125", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index f5ded456..1d4b8055 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.118", + "version": "0.0.125", "publisher": "Continue", "engines": { "vscode": "^1.67.0" @@ -146,8 +146,8 @@ }, { "command": "continue.quickTextEntry", - "mac": "cmd+h", - "key": "ctrl+h" + "mac": "cmd+shift+l", + "key": "ctrl+shift+l" } ], "menus": { diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 4dab8bcd..e6632360 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -293,8 +293,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { event.key === "Enter" && (!downshiftProps.isOpen || items.length === 0) ) { - downshiftProps.setInputValue(""); - const value = event.currentTarget.value; + const value = downshiftProps.inputValue; if (value !== "") { setPositionInHistory(history.length + 1); setHistory([...history, value]); @@ -302,10 +301,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { // Prevent Downshift's default 'Enter' behavior. (event.nativeEvent as any).preventDownshiftDefault = true; - // cmd+enter to /edit - if (event.metaKey) { - event.currentTarget.value = `/edit ${event.currentTarget.value}`; - } if (props.onEnter) props.onEnter(event); } else if (event.key === "Tab" && items.length > 0) { downshiftProps.setInputValue(items[0].name); diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 1ea70dd2..e1ecec9e 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -217,9 +217,13 @@ function GUI(props: GUIProps) { [client] ); - const onMainTextInput = () => { + const onMainTextInput = (event?: any) => { if (mainTextInputRef.current) { - const input = (mainTextInputRef.current as any).inputValue; + let input = (mainTextInputRef.current as any).inputValue; + // cmd+enter to /edit + if (event?.metaKey) { + input = `/edit ${input}`; + } (mainTextInputRef.current as any).setInputValue(""); if (!client) return; @@ -352,7 +356,7 @@ function GUI(props: GUIProps) { // } ref={mainTextInputRef} onEnter={(e) => { - onMainTextInput(); + onMainTextInput(e); e.stopPropagation(); e.preventDefault(); }} diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index f6cc129e..bbf93f65 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -10,7 +10,7 @@ import * as vscode from "vscode"; import fkill from "fkill"; import { sendTelemetryEvent, TelemetryEvent } from "../telemetry"; -const MAX_RETRIES = 0; +const MAX_RETRIES = 3; async function retryThenFail( fn: () => Promise<any>, retries: number = MAX_RETRIES @@ -197,7 +197,7 @@ async function setupPythonEnv() { } else if (stderr) { if (stderr.includes("running scripts is disabled on this system")) { vscode.window.showErrorMessage( - "A Python virtual enviroment cannot be activated because running scripts is disabled for this user. Please enable signed scripts to run with this command in PowerShell: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`, reload VS Code, and then try again." + "A Python virtual enviroment cannot be activated because running scripts is disabled for this user. Please enable signed scripts to run with this command in PowerShell: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`, reload VS Code, and then try again." ); } throw new Error(stderr); diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 9b16a7a2..679d94ba 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -164,7 +164,7 @@ class IdeProtocolClient { this.showSuggestion(data.edit); break; case "showDiff": - this.showDiff(data.filepath, data.replacement); + this.showDiff(data.filepath, data.replacement, data.step_index); break; case "openGUI": case "connected": @@ -243,8 +243,8 @@ class IdeProtocolClient { ); } - showDiff(filepath: string, replacement: string) { - diffManager.writeDiff(filepath, replacement); + showDiff(filepath: string, replacement: string, step_index: number) { + diffManager.writeDiff(filepath, replacement, step_index); } openFile(filepath: string) { @@ -431,6 +431,10 @@ class IdeProtocolClient { sendMainUserInput(input: string) { this.messenger?.send("mainUserInput", { input }); } + + deleteAtIndex(index: number) { + this.messenger?.send("deleteAtIndex", { index }); + } } export default IdeProtocolClient; diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 52a54046..dbfd8f59 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -8,6 +8,7 @@ interface DiffInfo { originalFilepath: string; newFilepath: string; editor?: vscode.TextEditor; + step_index: number; } export const DIFF_DIRECTORY = path.join(os.homedir(), ".continue", "diffs"); @@ -36,8 +37,7 @@ class DiffManager { private openDiffEditor( originalFilepath: string, - newFilepath: string, - newContent: string + newFilepath: string ): vscode.TextEditor | undefined { // If the file doesn't yet exist, don't open the diff editor if (!fs.existsSync(newFilepath)) { @@ -62,7 +62,11 @@ class DiffManager { return editor; } - writeDiff(originalFilepath: string, newContent: string): string { + writeDiff( + originalFilepath: string, + newContent: string, + step_index: number + ): string { this.setupDirectory(); // Create or update existing diff @@ -77,6 +81,7 @@ class DiffManager { const diffInfo: DiffInfo = { originalFilepath, newFilepath, + step_index, }; this.diffs.set(newFilepath, diffInfo); } @@ -84,11 +89,7 @@ class DiffManager { // Open the editor if it hasn't been opened yet const diffInfo = this.diffs.get(newFilepath); if (diffInfo && !diffInfo?.editor) { - diffInfo.editor = this.openDiffEditor( - originalFilepath, - newFilepath, - newContent - ); + diffInfo.editor = this.openDiffEditor(originalFilepath, newFilepath); this.diffs.set(newFilepath, diffInfo); } @@ -101,7 +102,7 @@ class DiffManager { vscode.window.showTextDocument(diffInfo.editor.document); vscode.commands.executeCommand("workbench.action.closeActiveEditor"); } - // this.diffs.delete(diffInfo.newFilepath); + this.diffs.delete(diffInfo.newFilepath); fs.unlinkSync(diffInfo.newFilepath); } @@ -138,6 +139,9 @@ class DiffManager { return; } + // Stop the step at step_index in case it is still streaming + ideProtocolClient.deleteAtIndex(diffInfo.step_index); + this.cleanUpDiff(diffInfo); } } |