summaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
Diffstat (limited to 'extension')
-rw-r--r--extension/package.json5
-rw-r--r--extension/react-app/src/redux/store.ts2
-rw-r--r--extension/scripts/typegen.js15
-rw-r--r--extension/src/activation/environmentSetup.ts15
-rw-r--r--extension/src/debugPanel.ts4
-rw-r--r--extension/src/util/util.ts9
6 files changed, 29 insertions, 21 deletions
diff --git a/extension/package.json b/extension/package.json
index 03495830..fb4a2df8 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -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/redux/store.ts b/extension/react-app/src/redux/store.ts
index 59339060..a9a45ec1 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 c2ac0b22..f0e41ca9 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -237,10 +237,14 @@ 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) {
retry();
@@ -248,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 e6dade37..61ff455a 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[]) {