command m reliable toggle
This commit is contained in:
parent
612c4115a0
commit
a16101b499
6 changed files with 28 additions and 13 deletions
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue