diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 8 | ||||
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 21 | ||||
-rw-r--r-- | extension/react-app/src/components/HeaderButtonWithText.tsx | 4 | ||||
-rw-r--r-- | extension/react-app/src/components/StepContainer.tsx | 1 | ||||
-rw-r--r-- | extension/react-app/src/components/TextDialog.tsx | 28 | ||||
-rw-r--r-- | extension/react-app/src/tabs/gui.tsx | 3 | ||||
-rw-r--r-- | extension/src/commands.ts | 5 | ||||
-rw-r--r-- | extension/src/continueIdeClient.ts | 2 |
9 files changed, 59 insertions, 17 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json index 86c816e0..92df6a4f 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.47", + "version": "0.0.50", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.47", + "version": "0.0.50", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 3a3927f3..a875c82d 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "Refine code 10x faster", - "version": "0.0.47", + "version": "0.0.50", "publisher": "Continue", "engines": { "vscode": "^1.74.0" @@ -86,8 +86,8 @@ "activitybar": [ { "id": "continue", - "title": "Continue", - "icon": "media/continue-gradient.png" + "title": "Continue ", + "icon": "react-app/dist/continue_arrow.png" } ] }, @@ -96,7 +96,7 @@ { "type": "webview", "id": "continue.continueGUIView", - "name": ")", + "name": " )", "visibility": "visible" } ] diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 2b140567..29f8a53b 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -68,6 +68,9 @@ interface ComboBoxProps { } const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { + const [history, setHistory] = React.useState<string[]>([]); + // The position of the current command you are typing now, so the one that will be appended to history once you press enter + const [positionInHistory, setPositionInHistory] = React.useState<number>(0); const [items, setItems] = React.useState(props.items); const { isOpen, @@ -113,9 +116,27 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { (event.nativeEvent as any).preventDownshiftDefault = true; if (props.onEnter) props.onEnter(event); setInputValue(""); + const value = event.currentTarget.value; + if (value !== "") { + setPositionInHistory(history.length + 1); + setHistory([...history, value]); + } } else if (event.key === "Tab" && items.length > 0) { setInputValue(items[0].name); event.preventDefault(); + } else if (event.key === "ArrowUp" && !isOpen) { + if (positionInHistory == 0) return; + setInputValue(history[positionInHistory - 1]); + setPositionInHistory((prev) => prev - 1); + } else if (event.key === "ArrowDown" && !isOpen) { + if (positionInHistory >= history.length - 1) { + setInputValue(""); + } else { + setInputValue(history[positionInHistory + 1]); + } + setPositionInHistory((prev) => + Math.min(prev + 1, history.length) + ); } }, ref: ref as any, diff --git a/extension/react-app/src/components/HeaderButtonWithText.tsx b/extension/react-app/src/components/HeaderButtonWithText.tsx index c4f22211..f9483f0f 100644 --- a/extension/react-app/src/components/HeaderButtonWithText.tsx +++ b/extension/react-app/src/components/HeaderButtonWithText.tsx @@ -15,9 +15,7 @@ const HeaderButtonWithText = (props: HeaderButtonWithTextProps) => { style={{ padding: "3px" }} onMouseEnter={() => setHover(true)} onMouseLeave={() => { - setTimeout(() => { - setHover(false); - }, 100); + setHover(false); }} onClick={props.onClick} > diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx index 480f517f..7adbd7c2 100644 --- a/extension/react-app/src/components/StepContainer.tsx +++ b/extension/react-app/src/components/StepContainer.tsx @@ -63,7 +63,6 @@ const HeaderDiv = styled.div<{ error: boolean }>` const ContentDiv = styled.div` padding: 8px; padding-left: 16px; - background-color: ${vscBackground}; `; const OnHoverDiv = styled.div` diff --git a/extension/react-app/src/components/TextDialog.tsx b/extension/react-app/src/components/TextDialog.tsx index 167e12cf..31a385d5 100644 --- a/extension/react-app/src/components/TextDialog.tsx +++ b/extension/react-app/src/components/TextDialog.tsx @@ -1,5 +1,5 @@ // Write a component that displays a dialog box with a text field and a button. -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import styled from "styled-components"; import { Button, buttonColor, secondaryDark, vscBackground } from "."; @@ -28,6 +28,10 @@ const TextArea = styled.textarea` padding: 8px; outline: 1px solid black; font-family: Arial, Helvetica, sans-serif; + + &:focus { + outline: 1px solid orange; + } `; const P = styled.p` @@ -38,19 +42,39 @@ const P = styled.p` const TextDialog = (props: { showDialog: boolean; onEnter: (text: string) => void; + onClose: () => void; }) => { const [text, setText] = useState(""); const textAreaRef = React.createRef<HTMLTextAreaElement>(); + useEffect(() => { + if (textAreaRef.current) { + textAreaRef.current.focus(); + } + }, [props.showDialog]); + return ( <DialogContainer hidden={!props.showDialog}> <Dialog> <P>Thanks for your feedback. We'll get back to you soon!</P> - <TextArea cols={50} rows={10} ref={textAreaRef}></TextArea> + <TextArea + cols={50} + rows={10} + ref={textAreaRef} + onKeyDown={(e) => { + if (e.key === "Enter" && e.metaKey && textAreaRef.current) { + props.onEnter(textAreaRef.current.value); + setText(""); + } else if (e.key === "Escape") { + props.onClose(); + } + }} + /> <Button onClick={() => { if (textAreaRef.current) { props.onEnter(textAreaRef.current.value); + setText(""); } }} > diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 994cb896..63da595f 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -297,6 +297,9 @@ function GUI(props: GUIProps) { client?.sendMainInput(`/feedback ${text}`); setShowFeedbackDialog(false); }} + onClose={() => { + setShowFeedbackDialog(false); + }} ></TextDialog> <TopGUIDiv diff --git a/extension/src/commands.ts b/extension/src/commands.ts index c98cd3c3..5392a7a3 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -61,12 +61,9 @@ const commandsMap: { [command: string]: (...args: any) => any } = { "continue.suggestionUp": suggestionUpCommand, "continue.acceptSuggestion": acceptSuggestionCommand, "continue.rejectSuggestion": rejectSuggestionCommand, - "continue.openContinueGUI": () => { - ideProtocolClient.openGUI(); - }, "continue.focusContinueInput": async () => { if (!debugPanelWebview) { - await ideProtocolClient.openGUI(); + vscode.commands.executeCommand("continue.continueGUIView.focus"); } debugPanelWebview?.postMessage({ type: "focusContinueInput", diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 9a93a4ef..b4937ac4 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -192,7 +192,7 @@ class IdeProtocolClient { async getUserSecret(key: string) { // Check if secret already exists in VS Code settings (global) let secret = vscode.workspace.getConfiguration("continue").get(key); - if (typeof secret !== "undefined") return secret; + if (typeof secret !== "undefined" && secret !== null) return secret; // If not, ask user for secret secret = await vscode.window.showInputBox({ |