summaryrefslogtreecommitdiff
path: root/extension/src
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-26 00:26:02 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-26 00:26:02 -0700
commit79a2fa634e5b5d44e13fbd49facf14a4fc3745d1 (patch)
tree0e5917d1ae3fad12e4cf459ec273593d9d5267a4 /extension/src
parentb759e2dbfe36b3e8873527b9736d64866da9b604 (diff)
parent2b69bf6f1fc2e06b16b718358ceed4911d6e87c3 (diff)
downloadsncontinue-79a2fa634e5b5d44e13fbd49facf14a4fc3745d1.tar.gz
sncontinue-79a2fa634e5b5d44e13fbd49facf14a4fc3745d1.tar.bz2
sncontinue-79a2fa634e5b5d44e13fbd49facf14a4fc3745d1.zip
Merge branch 'config-py' into merge-config-py-TO-main
Diffstat (limited to 'extension/src')
-rw-r--r--extension/src/activation/activate.ts3
-rw-r--r--extension/src/bridge.ts73
-rw-r--r--extension/src/continueIdeClient.ts3
-rw-r--r--extension/src/debugPanel.ts2
-rw-r--r--extension/src/util/messenger.ts1
5 files changed, 7 insertions, 75 deletions
diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts
index a1d88a31..356d0256 100644
--- a/extension/src/activation/activate.ts
+++ b/extension/src/activation/activate.ts
@@ -17,7 +17,7 @@ export let ideProtocolClient: IdeProtocolClient;
export async function activateExtension(context: vscode.ExtensionContext) {
extensionContext = context;
-
+ console.log("Using Continue version: ", getExtensionVersion());
// Before anything else, check whether this is an out-of-date version of the extension
// Do so by grabbing the package.json off of the GitHub respository for now.
fetch(PACKAGE_JSON_RAW_GITHUB_URL)
@@ -67,6 +67,7 @@ export async function activateExtension(context: vscode.ExtensionContext) {
}, 2000);
});
+ console.log("Continue server started");
// Initialize IDE Protocol Client
const serverUrl = getContinueServerUrl();
ideProtocolClient = new IdeProtocolClient(
diff --git a/extension/src/bridge.ts b/extension/src/bridge.ts
index d614ace4..0d665826 100644
--- a/extension/src/bridge.ts
+++ b/extension/src/bridge.ts
@@ -1,44 +1,5 @@
-import fetch from "node-fetch";
-import * as path from "path";
import * as vscode from "vscode";
-import { Configuration, DebugApi, UnittestApi } from "./client";
-import { convertSingleToDoubleQuoteJSON } from "./util/util";
-import { getExtensionUri } from "./util/vscode";
import { extensionContext } from "./activation/activate";
-const util = require("util");
-const exec = util.promisify(require("child_process").exec);
-
-const configuration = new Configuration({
- basePath: get_api_url(),
- fetchApi: fetch as any,
- middleware: [
- {
- pre: async (context) => {
- // If there is a SerializedDebugContext in the body, add the files for the filesystem
- context.init.body;
-
- // Add the VS Code Machine Code Header
- context.init.headers = {
- ...context.init.headers,
- "x-vsc-machine-id": vscode.env.machineId,
- };
- },
- },
- ],
-});
-export const debugApi = new DebugApi(configuration);
-export const unittestApi = new UnittestApi(configuration);
-
-export function get_api_url() {
- const extensionUri = getExtensionUri();
- const configFile = path.join(extensionUri.fsPath, "config/config.json");
- const config = require(configFile);
-
- if (config.API_URL) {
- return config.API_URL;
- }
- return "http://localhost:65432";
-}
export function getContinueServerUrl() {
// If in debug mode, always use 8001
@@ -53,37 +14,3 @@ export function getContinueServerUrl() {
"http://localhost:65432"
);
}
-
-function listToCmdLineArgs(list: string[]): string {
- return list.map((el) => `"$(echo "${el}")"`).join(" ");
-}
-
-export async function runPythonScript(
- scriptName: string,
- args: string[]
-): Promise<any> {
- // TODO: Need to make sure that the path to poetry is in the PATH and that it is installed in the first place. Realistically also need to install npm in some cases.
- const command = `export PATH="$PATH:/opt/homebrew/bin" && cd ${path.join(
- getExtensionUri().fsPath,
- "scripts"
- )} && source env/bin/activate && python3 ${scriptName} ${listToCmdLineArgs(
- args
- )}`;
-
- const { stdout, stderr } = await exec(command);
-
- try {
- let jsonString = stdout.substring(
- stdout.indexOf("{"),
- stdout.lastIndexOf("}") + 1
- );
- jsonString = convertSingleToDoubleQuoteJSON(jsonString);
- return JSON.parse(jsonString);
- } catch (e) {
- if (stderr) {
- throw new Error(stderr);
- } else {
- throw new Error("Failed to parse JSON: " + e);
- }
- }
-}
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index 802afc1d..d92a829d 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -399,8 +399,9 @@ class IdeProtocolClient {
}
}, 1000);
});
+ console.log("Getting session ID");
const resp = await this.messenger?.sendAndReceive("getSessionId", {});
- // console.log("New Continue session with ID: ", sessionId);
+ console.log("New Continue session with ID: ", resp.sessionId);
this._sessionId = resp.sessionId;
return resp.sessionId;
}
diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts
index 6da79cdc..6dcb588a 100644
--- a/extension/src/debugPanel.ts
+++ b/extension/src/debugPanel.ts
@@ -166,11 +166,13 @@ export function setupDebugPanel(
switch (data.type) {
case "onLoad": {
let sessionId: string;
+ console.log("Running onLoad");
if (typeof sessionIdPromise === "string") {
sessionId = sessionIdPromise;
} else {
sessionId = await sessionIdPromise;
}
+ console.log("Done with onLoad: ", sessionId);
panel.webview.postMessage({
type: "onLoad",
vscMachineId: vscode.env.machineId,
diff --git a/extension/src/util/messenger.ts b/extension/src/util/messenger.ts
index 3044898e..32490a68 100644
--- a/extension/src/util/messenger.ts
+++ b/extension/src/util/messenger.ts
@@ -39,6 +39,7 @@ export class WebsocketMessenger extends Messenger {
// var WebSocket = require("ws");
// }
+ console.log("Creating websocket at: ", this.serverUrl);
const newWebsocket = new WebSocket(this.serverUrl);
for (const listener of this.onOpenListeners) {
this.onOpen(listener);