summaryrefslogtreecommitdiff
path: root/extension/src
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-05-28 15:11:46 -0400
committerNate Sesti <sestinj@gmail.com>2023-05-28 15:11:46 -0400
commit64643e87e9af8b98945614119179e45fc95281e4 (patch)
tree396156b0cca282c936a60a20b33ba725e956d1dc /extension/src
parent306ab404ce687db5a67762d63b159118ab592837 (diff)
downloadsncontinue-64643e87e9af8b98945614119179e45fc95281e4.tar.gz
sncontinue-64643e87e9af8b98945614119179e45fc95281e4.tar.bz2
sncontinue-64643e87e9af8b98945614119179e45fc95281e4.zip
First load fail error fixed
Diffstat (limited to 'extension/src')
-rw-r--r--extension/src/activation/environmentSetup.ts5
-rw-r--r--extension/src/continueIdeClient.ts26
2 files changed, 17 insertions, 14 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index 1e921c18..93a471ff 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -143,9 +143,7 @@ export async function startContinuePythonServer() {
console.log("Continue python server already running");
return;
}
- } catch (e) {
- console.log("Error checking for existing server", e);
- }
+ } catch (e) {}
let activateCmd = ". env/bin/activate";
let pythonCmd = "python3";
@@ -162,6 +160,7 @@ export async function startContinuePythonServer() {
// exec(command);
let child = spawn(command, {
shell: true,
+ detached: true,
});
child.stdout.on("data", (data: any) => {
console.log(`stdout: ${data}`);
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index 6c65415f..35eb668d 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -66,18 +66,22 @@ class IdeProtocolClient {
}
async isConnected() {
- if (this._ws === null) {
- this._ws = new WebSocket(this._serverUrl);
- }
- // On open, return a promise
- if (this._ws!.readyState === WebSocket.OPEN) {
- return;
- }
- return new Promise((resolve, reject) => {
- this._ws!.onopen = () => {
- resolve(null);
+ if (this._ws === null || this._ws.readyState !== WebSocket.OPEN) {
+ let ws = new WebSocket(this._serverUrl);
+ ws.onclose = () => {
+ this._ws = null;
};
- });
+ ws.on("message", (data: any) => {
+ this.handleMessage(JSON.parse(data));
+ });
+ this._ws = ws;
+
+ return new Promise((resolve, reject) => {
+ ws.addEventListener("open", () => {
+ resolve(null);
+ });
+ });
+ }
}
async startCore() {