diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-14 11:01:06 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-14 11:01:06 -0700 |
commit | a16101b49950fba146e8627ffbce3a34e61bb061 (patch) | |
tree | 86ff2fa00c2ff145a37317734b1253cb3975e1df | |
parent | 612c4115a0c74b52b77956867e0f47a84eca98a9 (diff) | |
download | sncontinue-a16101b49950fba146e8627ffbce3a34e61bb061.tar.gz sncontinue-a16101b49950fba146e8627ffbce3a34e61bb061.tar.bz2 sncontinue-a16101b49950fba146e8627ffbce3a34e61bb061.zip |
command m reliable toggle
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 2 | ||||
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 4 | ||||
-rw-r--r-- | extension/src/commands.ts | 5 | ||||
-rw-r--r-- | extension/src/debugPanel.ts | 5 | ||||
-rw-r--r-- | extension/src/diffs.ts | 21 |
6 files changed, 28 insertions, 13 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json index a79dd6b4..12aa27c9 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.164", + "version": "0.0.165", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.164", + "version": "0.0.165", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index de1f395d..05bd4d84 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.164", + "version": "0.0.165", "publisher": "Continue", "engines": { "vscode": "^1.67.0" diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index bd0d59b5..5d9b5109 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -12,6 +12,7 @@ import PillButton from "./PillButton"; import HeaderButtonWithText from "./HeaderButtonWithText"; import { DocumentPlus } from "@styled-icons/heroicons-outline"; import { HighlightedRangeContext } from "../../../schema/FullState"; +import { postVscMessage } from "../vscode"; // #region styled components const mainInputFontSize = 13; @@ -297,6 +298,9 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { // setShowContextDropdown(target.value.endsWith("@")); }, + onBlur: (e) => { + postVscMessage("blurContinueInput", {}); + }, onKeyDown: (event) => { if (event.key === "Enter" && event.shiftKey) { // Prevent Downshift's default 'Enter' behavior. diff --git a/extension/src/commands.ts b/extension/src/commands.ts index 0025340a..888f01ed 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -16,11 +16,14 @@ import { import { acceptDiffCommand, rejectDiffCommand } from "./diffs"; import * as bridge from "./bridge"; import { debugPanelWebview } from "./debugPanel"; -import { sendTelemetryEvent, TelemetryEvent } from "./telemetry"; import { ideProtocolClient } from "./activation/activate"; let focusedOnContinueInput = false; +export const setFocusedOnContinueInput = (value: boolean) => { + focusedOnContinueInput = value; +}; + // Copy everything over from extension.ts const commandsMap: { [command: string]: (...args: any) => any } = { "continue.suggestionDown": suggestionDownCommand, diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index 5e1689d1..dd24a8d8 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -6,6 +6,7 @@ import { openEditorAndRevealRange, } from "./util/vscode"; import { RangeInFile } from "./client"; +import { setFocusedOnContinueInput } from "./commands"; const WebSocket = require("ws"); let websocketConnections: { [url: string]: WebsocketConnection | undefined } = @@ -226,6 +227,10 @@ export function setupDebugPanel( openEditorAndRevealRange(data.path, undefined, vscode.ViewColumn.One); break; } + case "blurContinueInput": { + setFocusedOnContinueInput(false); + break; + } case "withProgress": { // This message allows withProgress to be used in the webview if (data.done) { diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 910c30f2..37943de4 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -104,6 +104,17 @@ class DiffManager { return editor; } + private _findFirstDifferentLine(contentA: string, contentB: string): number { + const linesA = contentA.split("\n"); + const linesB = contentB.split("\n"); + for (let i = 0; i < linesA.length && i < linesB.length; i++) { + if (linesA[i] !== linesB[i]) { + return i; + } + } + return 0; + } + writeDiff( originalFilepath: string, newContent: string, @@ -119,15 +130,7 @@ class DiffManager { if (!this.diffs.has(newFilepath)) { // Figure out the first line that is different const oldContent = fs.readFileSync(originalFilepath).toString("utf-8"); - let line = 0; - const newLines = newContent.split("\n"); - const oldLines = oldContent.split("\n"); - for (let i = 0; i < newLines.length && i < oldLines.length; i++) { - if (newLines[i] !== oldLines[i]) { - line = i; - break; - } - } + const line = this._findFirstDifferentLine(oldContent, newContent); const diffInfo: DiffInfo = { originalFilepath, |