diff --git a/extension/react-app/index.html b/extension/react-app/index.html
index e0d1c8408..043c307ed 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 e7b8dfb1b..000000000
--- 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 d104980bc..000000000
--- 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 5089fc472..000000000
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 8208a5000..000000000
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 6c87de9bb..000000000
--- 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 c0ab94001..000000000
--- 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 9268d7c9e..000000000
--- 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 bdec1d200..000000000
--- 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 b8071127d..000000000
--- 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 458f9d954..000000000
--- 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 ffb67ab5a..0b002549b 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