From f38a1a4dfa2bd9e0c8451227bc0e7c103f9da920 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 28 Jun 2023 16:44:12 -0700 Subject: try harder when checking for continuedev package --- extension/src/activation/environmentSetup.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'extension/src/activation/environmentSetup.ts') diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 168c79ad..6ea60195 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -101,9 +101,32 @@ function checkEnvExists() { } function checkRequirementsInstalled() { - return fs.existsSync( - path.join(getExtensionUri().fsPath, "scripts", ".continue_env_installed") + const envLibsPath = path.join( + getExtensionUri().fsPath, + "scripts", + "env", + process.platform == "win32" ? "Lib" : "lib" + ); + // Get the python version folder name + const pythonVersions = fs.readdirSync(envLibsPath).filter((f: string) => { + return f.startsWith("python"); + }); + if (pythonVersions.length == 0) { + return false; + } + + const continuePath = path.join( + envLibsPath, + pythonVersions[0], + "site-packages", + "continuedev" ); + + return fs.existsSync(continuePath); + + // return fs.existsSync( + // path.join(getExtensionUri().fsPath, "scripts", ".continue_env_installed") + // ); } async function setupPythonEnv() { -- cgit v1.2.3-70-g09d2 From 2f3d490d52aa3b87a3b6f9c28235b94e9d5d23da Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 28 Jun 2023 17:36:31 -0700 Subject: fixes --- continuedev/src/continuedev/server/ide.py | 12 +++++++---- continuedev/src/continuedev/steps/core/core.py | 2 +- extension/package-lock.json | 4 ++-- extension/package.json | 2 +- extension/src/activation/activate.ts | 3 ++- extension/src/activation/environmentSetup.ts | 28 ++++++++++++++------------ 6 files changed, 29 insertions(+), 22 deletions(-) (limited to 'extension/src/activation/environmentSetup.ts') diff --git a/continuedev/src/continuedev/server/ide.py b/continuedev/src/continuedev/server/ide.py index 6a94326a..ff0b2a24 100644 --- a/continuedev/src/continuedev/server/ide.py +++ b/continuedev/src/continuedev/server/ide.py @@ -253,10 +253,14 @@ class IdeProtocolServer(AbstractIdeProtocolServer): async def getUserSecret(self, key: str) -> str: """Get a user secret""" - resp = await self._send_and_receive_json({ - "key": key - }, GetUserSecretResponse, "getUserSecret") - return resp.value + try: + resp = await self._send_and_receive_json({ + "key": key + }, GetUserSecretResponse, "getUserSecret") + return resp.value + except Exception as e: + print("Error getting user secret", e) + return "" async def saveFile(self, filepath: str): """Save a file""" diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py index ad72212d..800f43b5 100644 --- a/continuedev/src/continuedev/steps/core/core.py +++ b/continuedev/src/continuedev/steps/core/core.py @@ -406,7 +406,7 @@ class DefaultModelEditCodeStep(Step): continue # Because really short lines might be expected to be repeated, this is only a !heuristic! # Stop when it starts copying the file_suffix - elif line.strip() == line_below_highlighted_range.strip() and len(line.strip()) > 4 and not line.strip() == original_lines_below_previous_blocks[0].strip(): + elif line.strip() == line_below_highlighted_range.strip() and len(line.strip()) > 4 and not (len(original_lines_below_previous_blocks) > 0 and line.strip() == original_lines_below_previous_blocks[0].strip()): repeating_file_suffix = True break diff --git a/extension/package-lock.json b/extension/package-lock.json index a4aff512..f8d85a19 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.79", + "version": "0.0.83", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.79", + "version": "0.0.83", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 44b55e89..4a623b74 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "Accelerating software development with language models", - "version": "0.0.79", + "version": "0.0.83", "publisher": "Continue", "engines": { "vscode": "^1.74.0" diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index df8b6871..05589d92 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -28,7 +28,8 @@ export async function activateExtension( vscode.window.withProgress( { location: vscode.ProgressLocation.Notification, - title: "Starting Continue Server...", + title: + "Starting Continue Server... (it may take a minute to download Python packages)", cancellable: false, }, async (progress, token) => { diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 6ea60195..4e6227c7 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -101,26 +101,28 @@ function checkEnvExists() { } function checkRequirementsInstalled() { - const envLibsPath = path.join( + let envLibsPath = path.join( getExtensionUri().fsPath, "scripts", "env", process.platform == "win32" ? "Lib" : "lib" ); - // Get the python version folder name - const pythonVersions = fs.readdirSync(envLibsPath).filter((f: string) => { - return f.startsWith("python"); - }); - if (pythonVersions.length == 0) { - return false; + // If site-packages is directly under env, use that + if (fs.existsSync(path.join(envLibsPath, "site-packages"))) { + envLibsPath = path.join(envLibsPath, "site-packages"); + } else { + // Get the python version folder name + const pythonVersions = fs.readdirSync(envLibsPath).filter((f: string) => { + return f.startsWith("python"); + }); + if (pythonVersions.length == 0) { + return false; + } + const pythonVersion = pythonVersions[0]; + envLibsPath = path.join(envLibsPath, pythonVersion, "site-packages"); } - const continuePath = path.join( - envLibsPath, - pythonVersions[0], - "site-packages", - "continuedev" - ); + const continuePath = path.join(envLibsPath, "continuedev"); return fs.existsSync(continuePath); -- cgit v1.2.3-70-g09d2 From 14f779412c086d569d6f86b9c3e871cbeb45c95a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 28 Jun 2023 19:43:08 -0700 Subject: fixed error when two windows open simultaneously --- extension/package-lock.json | 4 ++-- extension/package.json | 2 +- extension/src/activation/environmentSetup.ts | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'extension/src/activation/environmentSetup.ts') diff --git a/extension/package-lock.json b/extension/package-lock.json index 8f35c720..241ea5ca 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.85", + "version": "0.0.86", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.85", + "version": "0.0.86", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 3f030c3a..7eca6042 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "Accelerating software development with language models", - "version": "0.0.85", + "version": "0.0.86", "publisher": "Continue", "engines": { "vscode": "^1.74.0" diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 4e6227c7..823670fd 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -274,7 +274,10 @@ export async function startContinuePythonServer() { }); child.stderr.on("data", (data: any) => { console.log(`stderr: ${data}`); - if (data.includes("Uvicorn running on")) { + if ( + data.includes("Uvicorn running on") || // Successfully started the server + data.includes("address already in use") // The server is already running (probably a simultaneously opened VS Code window) + ) { console.log("Successfully started Continue python server"); resolve(null); } -- cgit v1.2.3-70-g09d2