From b9525d5f0851d13b3d4936868f064810f3376dbd Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Mon, 10 Jul 2023 15:25:29 -0700 Subject: adding onboarding --- extension/react-app/public/edit.gif | Bin 0 -> 41667733 bytes extension/react-app/public/explain.gif | Bin 0 -> 56475028 bytes extension/react-app/public/generate.gif | Bin 0 -> 32532380 bytes extension/react-app/public/intro.gif | Bin 0 -> 3976676 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 extension/react-app/public/edit.gif create mode 100644 extension/react-app/public/explain.gif create mode 100644 extension/react-app/public/generate.gif create mode 100644 extension/react-app/public/intro.gif (limited to 'extension/react-app/public') diff --git a/extension/react-app/public/edit.gif b/extension/react-app/public/edit.gif new file mode 100644 index 00000000..6780cdf7 Binary files /dev/null and b/extension/react-app/public/edit.gif differ diff --git a/extension/react-app/public/explain.gif b/extension/react-app/public/explain.gif new file mode 100644 index 00000000..e74803dc Binary files /dev/null and b/extension/react-app/public/explain.gif differ diff --git a/extension/react-app/public/generate.gif b/extension/react-app/public/generate.gif new file mode 100644 index 00000000..5c1d112b Binary files /dev/null and b/extension/react-app/public/generate.gif differ diff --git a/extension/react-app/public/intro.gif b/extension/react-app/public/intro.gif new file mode 100644 index 00000000..f872dc91 Binary files /dev/null and b/extension/react-app/public/intro.gif differ -- cgit v1.2.3-70-g09d2 From a8c91ffaccd181a0f6c28e3d218c3c7eeb0282c3 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 10 Jul 2023 20:08:04 -0700 Subject: gifs in outside media folder --- extension/package-lock.json | 4 ++-- extension/package.json | 2 +- extension/react-app/public/edit.gif | Bin 41667733 -> 0 bytes extension/react-app/public/explain.gif | Bin 56475028 -> 0 bytes extension/react-app/public/generate.gif | Bin 32532380 -> 0 bytes extension/react-app/public/intro.gif | Bin 3976676 -> 0 bytes extension/react-app/src/components/Onboarding.tsx | 2 +- media/edit.gif | Bin 0 -> 41667733 bytes media/explain.gif | Bin 0 -> 56475028 bytes media/generate.gif | Bin 0 -> 32532380 bytes media/intro.gif | Bin 0 -> 3976676 bytes 11 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 extension/react-app/public/edit.gif delete mode 100644 extension/react-app/public/explain.gif delete mode 100644 extension/react-app/public/generate.gif delete mode 100644 extension/react-app/public/intro.gif create mode 100644 media/edit.gif create mode 100644 media/explain.gif create mode 100644 media/generate.gif create mode 100644 media/intro.gif (limited to 'extension/react-app/public') diff --git a/extension/package-lock.json b/extension/package-lock.json index 5733c2dd..52b2e7b9 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.143", + "version": "0.0.146", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.143", + "version": "0.0.146", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 0477a450..393c5d70 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.143", + "version": "0.0.146", "publisher": "Continue", "engines": { "vscode": "^1.67.0" diff --git a/extension/react-app/public/edit.gif b/extension/react-app/public/edit.gif deleted file mode 100644 index 6780cdf7..00000000 Binary files a/extension/react-app/public/edit.gif and /dev/null differ diff --git a/extension/react-app/public/explain.gif b/extension/react-app/public/explain.gif deleted file mode 100644 index e74803dc..00000000 Binary files a/extension/react-app/public/explain.gif and /dev/null differ diff --git a/extension/react-app/public/generate.gif b/extension/react-app/public/generate.gif deleted file mode 100644 index 5c1d112b..00000000 Binary files a/extension/react-app/public/generate.gif and /dev/null differ diff --git a/extension/react-app/public/intro.gif b/extension/react-app/public/intro.gif deleted file mode 100644 index f872dc91..00000000 Binary files a/extension/react-app/public/intro.gif and /dev/null differ diff --git a/extension/react-app/src/components/Onboarding.tsx b/extension/react-app/src/components/Onboarding.tsx index 0e188e7a..1cbe61ec 100644 --- a/extension/react-app/src/components/Onboarding.tsx +++ b/extension/react-app/src/components/Onboarding.tsx @@ -76,7 +76,7 @@ const Onboarding = () => {

{topMessages[counter]}

{topMessages[counter]}
diff --git a/media/edit.gif b/media/edit.gif new file mode 100644 index 00000000..6780cdf7 Binary files /dev/null and b/media/edit.gif differ diff --git a/media/explain.gif b/media/explain.gif new file mode 100644 index 00000000..e74803dc Binary files /dev/null and b/media/explain.gif differ diff --git a/media/generate.gif b/media/generate.gif new file mode 100644 index 00000000..5c1d112b Binary files /dev/null and b/media/generate.gif differ diff --git a/media/intro.gif b/media/intro.gif new file mode 100644 index 00000000..f872dc91 Binary files /dev/null and b/media/intro.gif differ -- cgit v1.2.3-70-g09d2 From 93bf9cdd82765665b481b64be7d7896fb04690ad Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 12 Jul 2023 15:19:57 -0700 Subject: purging more --- extension/react-app/index.html | 2 +- extension/react-app/public/vite.svg | 1 - extension/react-app/src/TestPage.tsx | 33 --- extension/react-app/src/assets/Hubot-Sans.woff2 | Bin 165932 -> 0 bytes extension/react-app/src/assets/Mona-Sans.woff2 | Bin 133748 -> 0 bytes extension/react-app/src/assets/react.svg | 1 - .../react-app/src/components/CodeMultiselect.tsx | 276 --------------------- extension/react-app/src/highlight/dark.min.css | 53 ---- extension/react-app/src/util/api.ts | 43 ---- extension/react-app/src/util/editCache.ts | 89 ------- extension/react-app/src/util/index.ts | 27 -- extension/src/commands.ts | 92 +------ 12 files changed, 2 insertions(+), 615 deletions(-) delete mode 100644 extension/react-app/public/vite.svg delete mode 100644 extension/react-app/src/TestPage.tsx delete mode 100644 extension/react-app/src/assets/Hubot-Sans.woff2 delete mode 100644 extension/react-app/src/assets/Mona-Sans.woff2 delete mode 100644 extension/react-app/src/assets/react.svg delete mode 100644 extension/react-app/src/components/CodeMultiselect.tsx delete mode 100644 extension/react-app/src/highlight/dark.min.css delete mode 100644 extension/react-app/src/util/api.ts delete mode 100644 extension/react-app/src/util/editCache.ts delete mode 100644 extension/react-app/src/util/index.ts (limited to 'extension/react-app/public') diff --git a/extension/react-app/index.html b/extension/react-app/index.html index e0d1c840..043c307e 100644 --- a/extension/react-app/index.html +++ b/extension/react-app/index.html @@ -2,7 +2,7 @@ - + Vite + React + TS diff --git a/extension/react-app/public/vite.svg b/extension/react-app/public/vite.svg deleted file mode 100644 index e7b8dfb1..00000000 --- a/extension/react-app/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/extension/react-app/src/TestPage.tsx b/extension/react-app/src/TestPage.tsx deleted file mode 100644 index d104980b..00000000 --- a/extension/react-app/src/TestPage.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from "react"; -import styled from "styled-components"; - -const SideBySideDiv = styled.div` - display: grid; - grid-template-columns: 1fr 1fr; - grid-template-rows: 1fr; - grid-template-areas: "left right"; -`; - -const LeftDiv = styled.div` - grid-area: left; -`; - -const RightDiv = styled.div` - grid-area: right; -`; - -function TestPage() { - return ( -
-

Continue

- - -

Left

-
- -

Right

-
-
-
- ); -} diff --git a/extension/react-app/src/assets/Hubot-Sans.woff2 b/extension/react-app/src/assets/Hubot-Sans.woff2 deleted file mode 100644 index 5089fc47..00000000 Binary files a/extension/react-app/src/assets/Hubot-Sans.woff2 and /dev/null differ diff --git a/extension/react-app/src/assets/Mona-Sans.woff2 b/extension/react-app/src/assets/Mona-Sans.woff2 deleted file mode 100644 index 8208a500..00000000 Binary files a/extension/react-app/src/assets/Mona-Sans.woff2 and /dev/null differ diff --git a/extension/react-app/src/assets/react.svg b/extension/react-app/src/assets/react.svg deleted file mode 100644 index 6c87de9b..00000000 --- a/extension/react-app/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/extension/react-app/src/components/CodeMultiselect.tsx b/extension/react-app/src/components/CodeMultiselect.tsx deleted file mode 100644 index c0ab9400..00000000 --- a/extension/react-app/src/components/CodeMultiselect.tsx +++ /dev/null @@ -1,276 +0,0 @@ -import React, { useEffect, useState } from "react"; -import styled from "styled-components"; -import { Button, buttonColor, defaultBorderRadius, secondaryDark } from "."; -import { useSelector } from "react-redux"; -import { - selectDebugContext, - selectAllRangesInFiles, - selectRangesMask, -} from "../redux/selectors/debugContextSelectors"; -import "../highlight/dark.min.css"; -import hljs from "highlight.js"; -import { postVscMessage } from "../vscode"; -import { RootStore } from "../redux/store"; -import { useDispatch } from "react-redux"; -import { - addRangeInFile, - deleteRangeInFileAt, - toggleSelectionAt, - updateFileSystem, -} from "../redux/slices/debugContexSlice"; -import { RangeInFile } from "../../../src/client"; -import { readRangeInVirtualFileSystem } from "../util"; - -//#region Styled Components - -const MultiSelectContainer = styled.div` - border-radius: ${defaultBorderRadius}; - padding: 4px; - display: flex; - flex-direction: column; - gap: 4px; -`; - -const MultiSelectHeader = styled.div` - display: flex; - justify-content: space-between; - align-items: left; - border-bottom: 1px solid gray; - padding-left: 4px; - padding-right: 4px; - & p { - overflow-wrap: break-word; - word-wrap: break-word; - -ms-wrap-flow: break-word; - overflow: hidden; - } -`; - -const MultiSelectOption = styled.div` - border-radius: ${defaultBorderRadius}; - padding-top: 4px; - cursor: pointer; - background-color: ${secondaryDark}; -`; - -const DeleteSelectedRangeButton = styled(Button)` - align-self: right; - padding: 0px; - margin-top: 0; - aspect-ratio: 1/1; - height: 28px; -`; - -const ToggleHighlightButton = styled(Button)` - display: grid; - justify-content: center; - align-items: center; - grid-template-columns: 30px 1fr; - margin-left: 20px; - order: 1; - width: fit-content; -`; - -//#endregion - -//#region Path Formatting - -const filenameToLanguageMap: any = { - py: "python", - js: "javascript", - ts: "typescript", - html: "html", - css: "css", - java: "java", - c: "c", - cpp: "cpp", - cs: "csharp", - go: "go", - rb: "ruby", - rs: "rust", - swift: "swift", - php: "php", - scala: "scala", - kt: "kotlin", - dart: "dart", - hs: "haskell", - lua: "lua", - pl: "perl", - r: "r", - sql: "sql", - vb: "vb", - xml: "xml", - yaml: "yaml", -}; - -function filenameToLanguage(filename: string): string { - const extension = filename.split(".").pop(); - if (extension === undefined) { - return ""; - } - return filenameToLanguageMap[extension] || ""; -} - -function formatPathRelativeToWorkspace( - path: string, - workspacePath: string | undefined -) { - if (workspacePath === undefined) { - return path; - } - if (path.startsWith(workspacePath)) { - return path.substring(workspacePath.length + 1); - } else { - return path; - } -} - -function formatFileRange( - rangeInFile: RangeInFile, - workspacePath: string | undefined -) { - return `${formatPathRelativeToWorkspace( - rangeInFile.filepath, - workspacePath - )} (lines ${rangeInFile.range.start.line + 1}-${ - rangeInFile.range.end.line + 1 - })`; - // +1 because VS Code Ranges are 0-indexed -} - -//#endregion - -function CodeMultiselect(props: {}) { - // State - const [highlightLocked, setHighlightLocked] = useState(true); - - // Redux - const dispatch = useDispatch(); - const workspacePath = useSelector( - (state: RootStore) => state.config.workspacePath - ); - const debugContext = useSelector(selectDebugContext); - const rangesInFiles = useSelector(selectAllRangesInFiles); - const rangesInFilesMask = useSelector(selectRangesMask); - - useEffect(() => { - let eventListener = (event: any) => { - switch (event.data.type) { - case "highlightedCode": - if (!highlightLocked) { - dispatch( - addRangeInFile({ - rangeInFile: event.data.rangeInFile, - canUpdateLast: true, - }) - ); - dispatch(updateFileSystem(event.data.filesystem)); - } - break; - case "findSuspiciousCode": - for (let c of event.data.codeLocations) { - dispatch(addRangeInFile({ rangeInFile: c, canUpdateLast: false })); - } - dispatch(updateFileSystem(event.data.filesystem)); - postVscMessage("listTenThings", { debugContext }); - break; - } - }; - window.addEventListener("message", eventListener); - return () => window.removeEventListener("message", eventListener); - }, [debugContext, highlightLocked]); - - useEffect(() => { - hljs.highlightAll(); - }, [rangesInFiles]); - - return ( - - {rangesInFiles.map((range: RangeInFile, index: number) => { - return ( - { - dispatch(toggleSelectionAt(index)); - }} - > - -

- {formatFileRange(range, workspacePath)} -

- dispatch(deleteRangeInFileAt(index))} - > - x - -
-
-              
-                {readRangeInVirtualFileSystem(range, debugContext.filesystem)}
-              
-            
-
- ); - })} - {rangesInFiles.length === 0 && ( - <> -

Highlight relevant code in the editor.

- - )} - { - setHighlightLocked(!highlightLocked); - }} - > - {highlightLocked ? ( - <> - - - {" "} - Enable Highlight - - ) : ( - <> - - - {" "} - Disable Highlight - - )} - -
- ); -} - -export default CodeMultiselect; diff --git a/extension/react-app/src/highlight/dark.min.css b/extension/react-app/src/highlight/dark.min.css deleted file mode 100644 index 9268d7c9..00000000 --- a/extension/react-app/src/highlight/dark.min.css +++ /dev/null @@ -1,53 +0,0 @@ -pre code.hljs { - display: block; - overflow-x: auto; - padding: 1em; -} -code.hljs { - padding: 3px 5px; -} -.hljs { - color: #ddd; - background: #252526; -} -.hljs-keyword, -.hljs-link, -.hljs-literal, -.hljs-section, -.hljs-selector-tag { - color: #fff; -} -.hljs-addition, -.hljs-attribute, -.hljs-built_in, -.hljs-bullet, -.hljs-name, -.hljs-string, -.hljs-symbol, -.hljs-template-tag, -.hljs-template-variable, -.hljs-title, -.hljs-type, -.hljs-variable { - color: #d88; -} -.hljs-comment, -.hljs-deletion, -.hljs-meta, -.hljs-quote { - color: #979797; -} -.hljs-doctag, -.hljs-keyword, -.hljs-literal, -.hljs-name, -.hljs-section, -.hljs-selector-tag, -.hljs-strong, -.hljs-title, -.hljs-type { - font-weight: 700; -} -.hljs-emphasis { - font-style: italic; -} diff --git a/extension/react-app/src/util/api.ts b/extension/react-app/src/util/api.ts deleted file mode 100644 index bdec1d20..00000000 --- a/extension/react-app/src/util/api.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - Configuration, - DebugApi, - UnittestApi, - ChatApi, -} from "../../../src/client"; -import { useSelector } from "react-redux"; -import { useEffect, useState } from "react"; -import { RootStore } from "../redux/store"; - -export function useApi() { - const apiUrl = useSelector((state: RootStore) => state.config.apiUrl); - const vscMachineId = useSelector( - (state: RootStore) => state.config.vscMachineId - ); - const [debugApi, setDebugApi] = useState(); - const [unittestApi, setUnittestApi] = useState(); - const [chatApi, setChatApi] = useState(); - - useEffect(() => { - if (apiUrl && vscMachineId) { - let config = new Configuration({ - basePath: apiUrl, - fetchApi: fetch, - middleware: [ - { - pre: async (context) => { - context.init.headers = { - ...context.init.headers, - "x-vsc-machine-id": vscMachineId, - }; - }, - }, - ], - }); - setDebugApi(new DebugApi(config)); - setUnittestApi(new UnittestApi(config)); - setChatApi(new ChatApi(config)); - } - }, [apiUrl, vscMachineId]); - - return { debugApi, unittestApi, chatApi }; -} diff --git a/extension/react-app/src/util/editCache.ts b/extension/react-app/src/util/editCache.ts deleted file mode 100644 index b8071127..00000000 --- a/extension/react-app/src/util/editCache.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { useApi } from "../util/api"; -import { FileEdit, SerializedDebugContext } from "../../../src/client"; -import { useCallback, useEffect, useState } from "react"; - -export function useEditCache() { - const { debugApi } = useApi(); - - const fetchNewEdit = useCallback( - async (debugContext: SerializedDebugContext) => { - return ( - await debugApi?.editEndpointDebugEditPost({ - serializedDebugContext: debugContext, - }) - )?.completion; - }, - [debugApi] - ); - - const [editCache, setEditCache] = useState(new EditCache(fetchNewEdit)); - - useEffect(() => { - setEditCache(new EditCache(fetchNewEdit)); - }, [fetchNewEdit]); - - return editCache; -} - -/** - * Stores preloaded edits, invalidating based off of debug context changes - */ -class EditCache { - private _lastDebugContext: SerializedDebugContext | undefined; - private _cachedEdits: FileEdit[] | undefined; - private _fetchNewEdit: ( - debugContext: SerializedDebugContext - ) => Promise; - private _debounceTimer: NodeJS.Timeout | undefined; - - private _debugContextChanged(debugContext: SerializedDebugContext): boolean { - if (!this._lastDebugContext) { - return true; - } - - return ( - JSON.stringify(this._lastDebugContext) !== JSON.stringify(debugContext) - ); - } - - private _debugContextComplete(debugContext: SerializedDebugContext): boolean { - return debugContext.rangesInFiles.length > 0; - } - - public async preloadEdit(debugContext: SerializedDebugContext) { - if (this._debounceTimer) { - clearTimeout(this._debounceTimer); - } - if ( - this._debugContextComplete(debugContext) && - this._debugContextChanged(debugContext) - ) { - this._debounceTimer = setTimeout(async () => { - console.log("Preloading edits"); - this._cachedEdits = await this._fetchNewEdit(debugContext); - this._lastDebugContext = debugContext; - }, 200); - } - } - - public async getEdit( - debugContext: SerializedDebugContext - ): Promise { - if (this._debugContextChanged(debugContext)) { - console.log("Cache miss"); - this._cachedEdits = await this._fetchNewEdit(debugContext); - } else { - console.log("Cache hit"); - } - - return this._cachedEdits!; - } - - constructor( - fetchNewEdit: ( - debugContext: SerializedDebugContext - ) => Promise - ) { - this._fetchNewEdit = fetchNewEdit; - } -} diff --git a/extension/react-app/src/util/index.ts b/extension/react-app/src/util/index.ts deleted file mode 100644 index 458f9d95..00000000 --- a/extension/react-app/src/util/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { RangeInFile } from "../../../src/client"; - -export function readRangeInVirtualFileSystem( - rangeInFile: RangeInFile, - filesystem: { [filepath: string]: string } -): string | undefined { - const range = rangeInFile.range; - - let data = filesystem[rangeInFile.filepath]; - if (data === undefined) { - console.log("File not found"); - return undefined; - } else { - let lines = data.toString().split("\n"); - if (range.start.line === range.end.line) { - return lines[rangeInFile.range.start.line].slice( - rangeInFile.range.start.character, - rangeInFile.range.end.character - ); - } else { - let firstLine = lines[range.start.line].slice(range.start.character); - let lastLine = lines[range.end.line].slice(0, range.end.character); - let middleLines = lines.slice(range.start.line + 1, range.end.line); - return [firstLine, ...middleLines, lastLine].join("\n"); - } - } -} diff --git a/extension/src/commands.ts b/extension/src/commands.ts index ffb67ab5..0b002549 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -21,35 +21,6 @@ import { ideProtocolClient } from "./activation/activate"; // Copy everything over from extension.ts const commandsMap: { [command: string]: (...args: any) => any } = { - "continue.askQuestion": (data: any, webviewView: vscode.WebviewView) => { - if (!vscode.workspace.workspaceFolders) { - return; - } - - answerQuestion( - data.question, - vscode.workspace.workspaceFolders[0].uri.fsPath, - webviewView.webview - ); - }, - "continue.askQuestionFromInput": () => { - vscode.window - .showInputBox({ placeHolder: "Ask away!" }) - .then((question) => { - if (!question || !vscode.workspace.workspaceFolders) { - return; - } - - sendTelemetryEvent(TelemetryEvent.UniversalPromptQuery, { - query: question, - }); - - answerQuestion( - question, - vscode.workspace.workspaceFolders[0].uri.fsPath - ); - }); - }, "continue.suggestionDown": suggestionDownCommand, "continue.suggestionUp": suggestionUpCommand, "continue.acceptSuggestion": acceptSuggestionCommand, @@ -73,27 +44,6 @@ const commandsMap: { [command: string]: (...args: any) => any } = { if (text) { ideProtocolClient.sendMainUserInput(text); } - vscode.commands.executeCommand("continue.continueGUIView.focus"); - }, -}; - -const textEditorCommandsMap: { [command: string]: (...args: any) => {} } = { - "continue.writeDocstring": async (editor: vscode.TextEditor, _) => { - sendTelemetryEvent(TelemetryEvent.GenerateDocstring); - let gutterSpinnerKey = showGutterSpinner( - editor, - editor.selection.active.line - ); - - const { lineno, docstring } = await bridge.writeDocstringForFunction( - editor.document.fileName, - editor.selection.active - ); - // Can't use the edit given above after an async call - editor.edit((edit) => { - edit.insert(new vscode.Position(lineno, 0), docstring); - decorationManager.deleteDecoration(gutterSpinnerKey); - }); }, }; @@ -103,44 +53,4 @@ export function registerAllCommands(context: vscode.ExtensionContext) { vscode.commands.registerCommand(command, callback) ); } - - for (const [command, callback] of Object.entries(textEditorCommandsMap)) { - context.subscriptions.push( - vscode.commands.registerTextEditorCommand(command, callback) - ); - } -} - -async function answerQuestion( - question: string, - workspacePath: string, - webview: vscode.Webview | undefined = undefined -) { - vscode.window.withProgress( - { - location: vscode.ProgressLocation.Notification, - title: "Anwering question...", - cancellable: false, - }, - async (progress, token) => { - try { - let resp = await bridge.askQuestion(question, workspacePath); - // Send the answer back to the webview - if (webview) { - webview.postMessage({ - type: "answerQuestion", - answer: resp.answer, - }); - } - showAnswerInTextEditor(resp.filename, resp.range, resp.answer); - } catch (error: any) { - if (webview) { - webview.postMessage({ - type: "answerQuestion", - answer: error, - }); - } - } - } - ); -} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2