diff options
Diffstat (limited to 'extension')
-rw-r--r-- | extension/CONTRIBUTING.md (renamed from extension/DEV_README.md) | 20 | ||||
-rw-r--r-- | extension/README.md | 15 | ||||
-rw-r--r-- | extension/package-lock.json | 4 | ||||
-rw-r--r-- | extension/package.json | 7 | ||||
-rw-r--r-- | extension/react-app/src/components/Layout.tsx | 2 | ||||
-rw-r--r-- | extension/react-app/src/redux/slices/serverStateReducer.ts | 3 | ||||
-rw-r--r-- | extension/react-app/src/redux/store.ts | 2 | ||||
-rw-r--r-- | extension/scripts/typegen.js | 15 | ||||
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 16 | ||||
-rw-r--r-- | extension/src/debugPanel.ts | 4 | ||||
-rw-r--r-- | extension/src/util/util.ts | 9 |
11 files changed, 54 insertions, 43 deletions
diff --git a/extension/DEV_README.md b/extension/CONTRIBUTING.md index 3ad9cf68..953b5e48 100644 --- a/extension/DEV_README.md +++ b/extension/CONTRIBUTING.md @@ -6,25 +6,13 @@ This is the Continue VS Code Extension. Its primary jobs are 2. Open the Continue React app in a side panel. The React app's source code lives in the `react-app` directory. The panel is opened by the `continue.openContinueGUI` command, as defined in `src/commands.ts`. 3. Run a Continue server in the background, which connects to both the IDE protocol and the React app. The server is launched in `src/activation/environmentSetup.ts` by calling Python code that lives in `server/` (unless extension settings define a server URL other than localhost:65432, in which case the extension will just connect to that). -## How to debug the VS Code Extension +# How to run the extension -1. Clone the Continue repo +See [Environment Setup](../CONTRIBUTING.md#environment-setup) -2. Open a VS Code window with the `continue` directory as your workspace +# How to run and debug tests -3. Package and then start the FastAPI server by following instructions outlined in the `Continue Server` section of the `continuedev/README.md` - -4. Open a VS Code window with the `extension` directory as your workspace - -5. Run `npm run package` - -6. Open `src/activation/activate.ts` file (or any TypeScript file) - -7. Press `F5` on your keyboard to start `Run and Debug` mode - -8. `cmd+shift+p` to look at developer console and select Continue commands - -9. Every time you make changes to the code, you need to run `npm run esbuild` unless you make changes inside of `react-app` and then you need to run `npm run build` from there +After following the setup in [Environment Setup](../CONTRIBUTING.md#environment-setup) you can run `npm run test` in the command line or the `Server + Tests (VSCode)` launch configuration in VS Code to debug tests + server. ## Notes diff --git a/extension/README.md b/extension/README.md index 69bcb1f9..4a2d7892 100644 --- a/extension/README.md +++ b/extension/README.md @@ -1,9 +1,22 @@ -# Continue +<h1 align="center">Continue</h1> + +<div align="center"> **[Continue](https://continue.dev/docs) is the open-source autopilot for software developmentāa [VS Code extension](https://marketplace.visualstudio.com/items?itemName=Continue.continue) that brings the power of ChatGPT to your IDE** +</div> + +<div align="center"> + +[](https://opensource.org/licenses/Apache-2.0) +<a target="_blank" href="https://discord.gg/vapESyrFmJ" style="background:none"> +<img src="https://img.shields.io/badge/discord-join-continue.svg?labelColor=191937&color=6F6FF7&logo=discord" /> +</a> +  +</div> + ## Task, not tab, auto-complete ### Get possible explainations diff --git a/extension/package-lock.json b/extension/package-lock.json index 9a1baa8e..6f7d32b2 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.282", + "version": "0.0.296", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.282", + "version": "0.0.296", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index c059fb60..93b6e944 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.282", + "version": "0.0.296", "publisher": "Continue", "engines": { "vscode": "^1.67.0" @@ -183,19 +183,18 @@ ] }, "scripts": { - "esbuild-base": "rm -rf ./out && node esbuild.mjs", + "esbuild-base": "node esbuild.mjs", "vscode:prepublish": "npm run esbuild-base -- --minify", "esbuild": "npm run esbuild-base -- --sourcemap", "esbuild-watch": "npm run esbuild-base -- --sourcemap --watch", "tsc": "tsc -p ./", "tsc-watch": "tsc -watch -p ./", "typegen": "node scripts/typegen.js", - "clientgen": "rm -rf src/client/ && npx @openapitools/openapi-generator-cli generate -i ../schema/openapi.json -g typescript-fetch -o src/client/ --additional-properties=supportsES6=true,npmVersion=8.19.2,typescriptThreePlus=true", "rebuild": "electron-rebuild -v 19.1.8 node-pty", "lint": "eslint src --ext ts", "build-test": "tsc && node esbuild.test.mjs", "test": "npm run build-test && node ./out/test-runner/runTestOnVSCodeHost.js", - "package": "npm install && npm run typegen && npm run clientgen && cd react-app && npm install && npm run build && cd .. && mkdir -p ./build && vsce package --out ./build" + "package": "npm install && npm run typegen && cd react-app && npm install && npm run build && cd .. && mkdir -p ./build && vsce package --out ./build" }, "devDependencies": { "@nestjs/common": "^8.4.7", diff --git a/extension/react-app/src/components/Layout.tsx b/extension/react-app/src/components/Layout.tsx index a2e54173..a3b1946a 100644 --- a/extension/react-app/src/components/Layout.tsx +++ b/extension/react-app/src/components/Layout.tsx @@ -46,7 +46,7 @@ const BottomMessageDiv = styled.div<{ displayOnBottom: boolean }>` padding: 12px; z-index: 100; box-shadow: 0px 0px 2px 0px ${vscForeground}; - max-height: 50vh; + max-height: 35vh; overflow: scroll; `; diff --git a/extension/react-app/src/redux/slices/serverStateReducer.ts b/extension/react-app/src/redux/slices/serverStateReducer.ts index 22f6935e..bd60f1c7 100644 --- a/extension/react-app/src/redux/slices/serverStateReducer.ts +++ b/extension/react-app/src/redux/slices/serverStateReducer.ts @@ -10,7 +10,8 @@ const initialState: FullState = { hide: false, description: `- Highlight code section and ask a question or give instructions - Use \`cmd+m\` (Mac) / \`ctrl+m\` (Windows) to open Continue - - Use \`/help\` to ask questions about how to use Continue`, + - Use \`/help\` to ask questions about how to use Continue + - [Customize Continue](https://continue.dev/docs/customization) (e.g. use your own API key) by typing '/config'.`, system_message: null, chat_context: [], manage_own_chat_context: false, diff --git a/extension/react-app/src/redux/store.ts b/extension/react-app/src/redux/store.ts index bd6759e4..7959a067 100644 --- a/extension/react-app/src/redux/store.ts +++ b/extension/react-app/src/redux/store.ts @@ -3,8 +3,8 @@ import chatReducer from "./slices/chatSlice"; import configReducer from "./slices/configSlice"; import miscReducer from "./slices/miscSlice"; import uiStateReducer from "./slices/uiStateSlice"; -import { RangeInFile } from "../../../src/client"; import { FullState } from "../../../schema/FullState"; +import { RangeInFile } from "../../../schema/RangeInFile"; import serverStateReducer from "./slices/serverStateReducer"; export interface ChatMessage { diff --git a/extension/scripts/typegen.js b/extension/scripts/typegen.js index 0bbff19e..793eb08d 100644 --- a/extension/scripts/typegen.js +++ b/extension/scripts/typegen.js @@ -4,7 +4,7 @@ const { compile } = require("json-schema-to-typescript"); function generateTypesForFile(inputPath, outputPath) { let schema = JSON.parse(fs.readFileSync(inputPath, "utf8")); - let name = (inputPath.split("/").pop() || inputPath).split(".")[0]; + let name = path.parse(path.basename(inputPath)).name; // This is to solve the issue of json-schema-to-typescript not supporting $ref at the top-level, which is what Pydantic generates for recursive types if ("$ref" in schema) { let temp = schema["$ref"]; @@ -46,8 +46,15 @@ function deleteAllInDir(dir) { }); } -OUTPUT_DIR = "schema"; -INPUT_DIR = "../schema/json"; +const OUTPUT_DIR = path.join("schema"); +const INPUT_DIR = path.join("..", "schema", "json"); +if (!fs.existsSync(INPUT_DIR)) { + throw new Error(`Input directory does not exist: ${INPUT_DIR}`); +} + +if (!fs.existsSync(OUTPUT_DIR)) { + throw new Error(`Output directory does not exist: ${OUTPUT_DIR}`); +} deleteAllInDir(OUTPUT_DIR); -generateAllSchemas(INPUT_DIR, OUTPUT_DIR); +generateAllSchemas(INPUT_DIR, OUTPUT_DIR);
\ No newline at end of file diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 81d58afe..f0e41ca9 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -237,8 +237,13 @@ export async function startContinuePythonServer() { }; try { const child = spawn(destination, { - detached: true, - stdio: "ignore", + windowsHide: true, + }); + child.stdout.on("data", (data: any) => { + console.log(`stdout: ${data}`); + }); + child.stderr.on("data", (data: any) => { + console.log(`stderr: ${data}`); }); child.on("error", (err: any) => { if (attempts < maxAttempts) { @@ -247,7 +252,12 @@ export async function startContinuePythonServer() { console.error("Failed to start subprocess.", err); } }); - child.unref(); + child.on("exit", (code: any, signal: any) => { + console.log("Subprocess exited with code", code, signal); + }); + child.on("close", (code: any, signal: any) => { + console.log("Subprocess closed with code", code, signal); + }); } catch (e: any) { console.log("Error starting server:", e); retry(); diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index 6fb633ea..dbec45ea 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -5,7 +5,7 @@ import { getNonce, openEditorAndRevealRange, } from "./util/vscode"; -import { RangeInFile } from "./client"; +import { RangeInFile } from "../schema/RangeInFile"; import { setFocusedOnContinueInput } from "./commands"; const WebSocket = require("ws"); @@ -112,7 +112,7 @@ export function setupDebugPanel( } const rangeInFile: RangeInFile = { - range: e.selections[0], + range: e.selections[0] as any, filepath: e.textEditor.document.fileName, }; const filesystem = { diff --git a/extension/src/util/util.ts b/extension/src/util/util.ts index dfc10c90..15b34267 100644 --- a/extension/src/util/util.ts +++ b/extension/src/util/util.ts @@ -1,4 +1,4 @@ -import { RangeInFile, SerializedDebugContext } from "../client"; +import { RangeInFile } from "../../schema/RangeInFile"; import * as fs from "fs"; const os = require("os"); @@ -95,13 +95,6 @@ export function codeSelectionsToVirtualFileSystem( return virtualFileSystem; } -export function addFileSystemToDebugContext( - ctx: SerializedDebugContext -): SerializedDebugContext { - ctx.filesystem = codeSelectionsToVirtualFileSystem(ctx.rangesInFiles); - return ctx; -} - export function debounced(delay: number, fn: Function) { let timerId: NodeJS.Timeout | null; return function (...args: any[]) { |