summaryrefslogtreecommitdiff
path: root/extension/src/activation/environmentSetup.ts
diff options
context:
space:
mode:
authorTy Dunn <ty@tydunn.com>2023-06-28 23:10:54 -0700
committerTy Dunn <ty@tydunn.com>2023-06-28 23:10:54 -0700
commitb9e1ff3a1a2ea76a2a2ca754ee25df551381bbc6 (patch)
tree298d23233ee082e8d24da221612c0965161a4f5e /extension/src/activation/environmentSetup.ts
parent5cb80a064fe49ae64f5c15e1e4d130d7925a61f8 (diff)
parent14f779412c086d569d6f86b9c3e871cbeb45c95a (diff)
downloadsncontinue-b9e1ff3a1a2ea76a2a2ca754ee25df551381bbc6.tar.gz
sncontinue-b9e1ff3a1a2ea76a2a2ca754ee25df551381bbc6.tar.bz2
sncontinue-b9e1ff3a1a2ea76a2a2ca754ee25df551381bbc6.zip
Merge branch 'main' of github.com:continuedev/continue
Diffstat (limited to 'extension/src/activation/environmentSetup.ts')
-rw-r--r--extension/src/activation/environmentSetup.ts34
1 files changed, 31 insertions, 3 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index 168c79ad..823670fd 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -101,9 +101,34 @@ function checkEnvExists() {
}
function checkRequirementsInstalled() {
- return fs.existsSync(
- path.join(getExtensionUri().fsPath, "scripts", ".continue_env_installed")
+ let envLibsPath = path.join(
+ getExtensionUri().fsPath,
+ "scripts",
+ "env",
+ process.platform == "win32" ? "Lib" : "lib"
);
+ // 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, "continuedev");
+
+ return fs.existsSync(continuePath);
+
+ // return fs.existsSync(
+ // path.join(getExtensionUri().fsPath, "scripts", ".continue_env_installed")
+ // );
}
async function setupPythonEnv() {
@@ -249,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);
}