summaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
Diffstat (limited to 'extension')
-rw-r--r--extension/package-lock.json5
-rw-r--r--extension/package.json4
-rw-r--r--extension/scripts/install_from_source.py50
-rw-r--r--extension/src/activation/environmentSetup.ts5
-rw-r--r--extension/src/continueIdeClient.ts26
5 files changed, 56 insertions, 34 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json
index faa07b57..822b908e 100644
--- a/extension/package-lock.json
+++ b/extension/package-lock.json
@@ -1,12 +1,13 @@
{
"name": "continue",
- "version": "0.0.3",
+ "version": "0.0.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "0.0.3",
+ "version": "0.0.4",
+ "license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
"@reduxjs/toolkit": "^1.9.3",
diff --git a/extension/package.json b/extension/package.json
index 40d56fb7..f5771ee6 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -14,7 +14,7 @@
"displayName": "Continue",
"pricing": "Free",
"description": "Refine code 10x faster",
- "version": "0.0.3",
+ "version": "0.0.4",
"publisher": "Continue",
"engines": {
"vscode": "^1.74.0"
@@ -149,7 +149,7 @@
"scripts": {
"vscode:prepublish": "npm run esbuild-base -- --minify",
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node",
- "esbuild": "npm run esbuild-base -- --sourcemap",
+ "esbuild": "rm -rf ./out && npm run esbuild-base -- --sourcemap",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"test-compile": "tsc -p ./",
"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",
diff --git a/extension/scripts/install_from_source.py b/extension/scripts/install_from_source.py
index 4fe903ed..28f382b0 100644
--- a/extension/scripts/install_from_source.py
+++ b/extension/scripts/install_from_source.py
@@ -1,43 +1,61 @@
+import os
import subprocess
def run(cmd: str):
- return subprocess.run(cmd, shell=True, capture_output=True)
+ return subprocess.run(cmd, shell=True, capture_output=False)
def main():
# Check for Python and Node - we won't install them, but will warn
- out, err1 = run("python --version")
- out, err2 = run("python3 --version")
- if err1 and err2:
+ resp1 = run("python --version")
+ resp2 = run("python3 --version")
+ if resp1.stderr and resp2.stderr:
print("Python is required for Continue but is not installed on your machine. See https://www.python.org/downloads/ to download the latest version, then try again.")
return
- out, err = run("node --version")
- if err:
+ resp = run("node --version")
+ if resp.stderr:
print("Node is required for Continue but is not installed on your machine. See https://nodejs.org/en/download/ to download the latest version, then try again.")
return
- out, err = run("npm --version")
- if err:
+ resp = run("npm --version")
+ if resp.stderr:
print("NPM is required for Continue but is not installed on your machine. See https://nodejs.org/en/download/ to download the latest version, then try again.")
return
- out, err = run("poetry --version")
- if err:
+ resp = run("poetry --version")
+ if resp.stderr:
print("Poetry is required for Continue but is not installed on your machine. See https://python-poetry.org/docs/#installation to download the latest version, then try again.")
return
- out, err = run("cd ../../continuedev; poetry run typegen")
+ resp = run("cd ../../continuedev; poetry run typegen")
- out, err = run(
- "cd ..; npm i; cd react-app; npm i; cd ..; npm run full-package\r y\r npm run install-extension")
+ resp = run(
+ "cd ..; npm i; cd react-app; npm i; cd ..; npm run full-package")
- if err:
- print("Error installing the extension. Please try again.")
- print("This was the error: ", err)
+ if resp.stderr:
+ print("Error packaging the extension. Please try again.")
+ print("This was the error: ", resp.stderr)
return
+ latest = None
+ latest_major = 0
+ latest_minor = 0
+ latest_patch = 0
+ for file in os.listdir("../build"):
+ if file.endswith(".vsix"):
+ version = file.split("-")[1].split(".vsix")[0]
+ major, minor, patch = list(
+ map(lambda x: int(x), version.split(".")))
+ if latest is None or (major >= latest_major and minor >= latest_minor and patch > latest_patch):
+ latest = file
+ latest_major = major
+ latest_minor = minor
+ latest_patch = patch
+
+ resp = run(f"cd ..; code --install-extension ./build/{latest}")
+
print("Continue VS Code extension installed successfully. Please restart VS Code to use it.")
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() {