diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-08-05 00:07:11 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-08-05 00:07:11 -0700 |
commit | 68233071dd0d97a353a66fe5627d69f97a389ca8 (patch) | |
tree | 2e1904c10a7db0a21abc9f37cd28bad2a1934e7c /extension | |
parent | 9620ba0154bde0778a0fe453d9dab29ae9a8082d (diff) | |
download | sncontinue-68233071dd0d97a353a66fe5627d69f97a389ca8.tar.gz sncontinue-68233071dd0d97a353a66fe5627d69f97a389ca8.tar.bz2 sncontinue-68233071dd0d97a353a66fe5627d69f97a389ca8.zip |
fix: :bug: set api_keys in config.py, fix spawn error handling
Diffstat (limited to 'extension')
-rw-r--r-- | extension/package.json | 7 | ||||
-rw-r--r-- | extension/src/activation/activate.ts | 3 | ||||
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 40 |
3 files changed, 25 insertions, 25 deletions
diff --git a/extension/package.json b/extension/package.json index d4de7f2a..d4235d48 100644 --- a/extension/package.json +++ b/extension/package.json @@ -47,12 +47,7 @@ "continue.serverUrl": { "type": "string", "default": "http://localhost:65432", - "description": "The URL of the Continue server. Only change this if you are running the server manually. If you want to use an LLM hosted at a custom URL, please see https://continue.dev/docs/customization#change-the-default-llm." - }, - "continue.OPENAI_API_KEY": { - "type": "string", - "default": null, - "description": "The OpenAI API key to use for code generation. Leave empty to get limited free usage of Continue." + "description": "The URL of the Continue server. Only change this if you are running the server manually. If you want to use an LLM hosted at a custom URL, please see https://continue.dev/docs/customization#change-the-default-llm. All other configuration is done in `~/.continue/config.py`, which you can access by using the '/config' slash command." } } }, diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 560b970c..831d1160 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -54,9 +54,8 @@ export async function activateExtension(context: vscode.ExtensionContext) { registerAllCommands(context); registerQuickFixProvider(); - // Start the server and display loader if taking > 2 seconds + // Start the server const sessionIdPromise = (async () => { - // Start the server and set serverStarted to true when done await startContinuePythonServer(); console.log("Continue server started"); diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index d41cb289..1ca32841 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -231,23 +231,29 @@ export async function startContinuePythonServer() { let delay = 1000; // Delay between each attempt in milliseconds const spawnChild = () => { - const child = spawn(destination, { - detached: true, - stdio: "ignore", - }); - - child.on("error", (err: any) => { - if (attempts < maxAttempts) { - attempts++; - console.log( - `Error caught (likely EBUSY). Retrying attempt ${attempts}...` - ); - setTimeout(spawnChild, delay); - } else { - console.error("Failed to start subprocess.", err); - } - }); - child.unref(); + const retry = () => { + attempts++; + console.log( + `Error caught (likely EBUSY). Retrying attempt ${attempts}...` + ); + setTimeout(spawnChild, delay); + }; + try { + const child = spawn(destination, { + detached: true, + stdio: "ignore", + }); + child.on("error", (err: any) => { + if (attempts < maxAttempts) { + retry(); + } else { + console.error("Failed to start subprocess.", err); + } + }); + child.unref(); + } catch (e: any) { + retry(); + } }; spawnChild(); |