diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-24 20:02:43 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-24 20:02:43 -0700 |
commit | e788f27ae90ef6b8ff2c5df2cd1ed6e526cb920a (patch) | |
tree | 18de611b58f0a793ea402027f92a22672d26f39d | |
parent | e6e9655caf982f68d22ceab857cfe692baad922f (diff) | |
download | sncontinue-e788f27ae90ef6b8ff2c5df2cd1ed6e526cb920a.tar.gz sncontinue-e788f27ae90ef6b8ff2c5df2cd1ed6e526cb920a.tar.bz2 sncontinue-e788f27ae90ef6b8ff2c5df2cd1ed6e526cb920a.zip |
Removing unnecessary config.jsons
-rw-r--r-- | extension/config/dev_config.json | 3 | ||||
-rw-r--r-- | extension/config/prod_config.json | 3 | ||||
-rw-r--r-- | extension/src/bridge.ts | 73 |
3 files changed, 0 insertions, 79 deletions
diff --git a/extension/config/dev_config.json b/extension/config/dev_config.json deleted file mode 100644 index b4b9993e..00000000 --- a/extension/config/dev_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "API_URL": "http://localhost:65432" -} diff --git a/extension/config/prod_config.json b/extension/config/prod_config.json deleted file mode 100644 index dc0d0797..00000000 --- a/extension/config/prod_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "API_URL": "https://basin.dev" -} diff --git a/extension/src/bridge.ts b/extension/src/bridge.ts index d614ace4..0d665826 100644 --- a/extension/src/bridge.ts +++ b/extension/src/bridge.ts @@ -1,44 +1,5 @@ -import fetch from "node-fetch"; -import * as path from "path"; import * as vscode from "vscode"; -import { Configuration, DebugApi, UnittestApi } from "./client"; -import { convertSingleToDoubleQuoteJSON } from "./util/util"; -import { getExtensionUri } from "./util/vscode"; import { extensionContext } from "./activation/activate"; -const util = require("util"); -const exec = util.promisify(require("child_process").exec); - -const configuration = new Configuration({ - basePath: get_api_url(), - fetchApi: fetch as any, - middleware: [ - { - pre: async (context) => { - // If there is a SerializedDebugContext in the body, add the files for the filesystem - context.init.body; - - // Add the VS Code Machine Code Header - context.init.headers = { - ...context.init.headers, - "x-vsc-machine-id": vscode.env.machineId, - }; - }, - }, - ], -}); -export const debugApi = new DebugApi(configuration); -export const unittestApi = new UnittestApi(configuration); - -export function get_api_url() { - const extensionUri = getExtensionUri(); - const configFile = path.join(extensionUri.fsPath, "config/config.json"); - const config = require(configFile); - - if (config.API_URL) { - return config.API_URL; - } - return "http://localhost:65432"; -} export function getContinueServerUrl() { // If in debug mode, always use 8001 @@ -53,37 +14,3 @@ export function getContinueServerUrl() { "http://localhost:65432" ); } - -function listToCmdLineArgs(list: string[]): string { - return list.map((el) => `"$(echo "${el}")"`).join(" "); -} - -export async function runPythonScript( - scriptName: string, - args: string[] -): Promise<any> { - // TODO: Need to make sure that the path to poetry is in the PATH and that it is installed in the first place. Realistically also need to install npm in some cases. - const command = `export PATH="$PATH:/opt/homebrew/bin" && cd ${path.join( - getExtensionUri().fsPath, - "scripts" - )} && source env/bin/activate && python3 ${scriptName} ${listToCmdLineArgs( - args - )}`; - - const { stdout, stderr } = await exec(command); - - try { - let jsonString = stdout.substring( - stdout.indexOf("{"), - stdout.lastIndexOf("}") + 1 - ); - jsonString = convertSingleToDoubleQuoteJSON(jsonString); - return JSON.parse(jsonString); - } catch (e) { - if (stderr) { - throw new Error(stderr); - } else { - throw new Error("Failed to parse JSON: " + e); - } - } -} |