First load fail error fixed

This commit is contained in:
Nate Sesti 2023-05-28 15:11:46 -04:00
parent 306ab404ce
commit 64643e87e9
5 changed files with 56 additions and 34 deletions

View file

@ -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",

View file

@ -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",

View file

@ -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.")

View file

@ -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}`);

View file

@ -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() {