diff options
Diffstat (limited to 'extension/src')
| -rw-r--r-- | extension/src/activation/environmentSetup.ts | 2 | ||||
| -rw-r--r-- | extension/src/continueIdeClient.ts | 13 | ||||
| -rw-r--r-- | extension/src/test-runner/runTestOnVSCodeHost.ts | 5 | ||||
| -rw-r--r-- | extension/src/test-suite/environmentSetup.test.ts | 17 | 
4 files changed, 25 insertions, 12 deletions
| diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index f0e41ca9..748a5984 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -240,7 +240,7 @@ export async function startContinuePythonServer() {          windowsHide: true,        });        child.stdout.on("data", (data: any) => { -        console.log(`stdout: ${data}`); +        // console.log(`stdout: ${data}`);        });        child.stderr.on("data", (data: any) => {          console.log(`stderr: ${data}`); diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index d89093ca..5b9e285d 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -12,7 +12,7 @@ import {    rejectSuggestionCommand,  } from "./suggestions";  import { FileEditWithFullContents } from "../schema/FileEditWithFullContents"; -import * as fs from 'fs'; +import * as fs from "fs";  import { WebsocketMessenger } from "./util/messenger";  import { diffManager } from "./diffs";  const os = require("os"); @@ -30,13 +30,12 @@ class IdeProtocolClient {    private _lastReloadTime: number = 16;    private _reconnectionTimeouts: NodeJS.Timeout[] = []; -  private _sessionId: string | null = null; +  sessionId: string | null = null;    private _serverUrl: string;    private _newWebsocketMessenger() {      const requestUrl = -      this._serverUrl + -      (this._sessionId ? `?session_id=${this._sessionId}` : ""); +      this._serverUrl + (this.sessionId ? `?session_id=${this.sessionId}` : "");      const messenger = new WebsocketMessenger(requestUrl);      this.messenger = messenger; @@ -383,7 +382,9 @@ class IdeProtocolClient {    async getUserSecret(key: string) {      // Check if secret already exists in VS Code settings (global)      let secret = vscode.workspace.getConfiguration("continue").get(key); -    if (typeof secret !== "undefined" && secret !== null) {return secret;} +    if (typeof secret !== "undefined" && secret !== null) { +      return secret; +    }      // If not, ask user for secret      secret = await vscode.window.showInputBox({ @@ -420,7 +421,7 @@ class IdeProtocolClient {      console.log("Getting session ID");      const resp = await this.messenger?.sendAndReceive("getSessionId", {});      console.log("New Continue session with ID: ", resp.sessionId); -    this._sessionId = resp.sessionId; +    this.sessionId = resp.sessionId;      return resp.sessionId;    } diff --git a/extension/src/test-runner/runTestOnVSCodeHost.ts b/extension/src/test-runner/runTestOnVSCodeHost.ts index 2a542ffc..21267c2d 100644 --- a/extension/src/test-runner/runTestOnVSCodeHost.ts +++ b/extension/src/test-runner/runTestOnVSCodeHost.ts @@ -11,7 +11,10 @@ async function main() {      // The path to test runner      // Passed to --extensionTestsPath -    const extensionTestsPath = path.resolve(extensionDevelopmentPath, "out/test-runner/mochaRunner"); +    const extensionTestsPath = path.resolve( +      extensionDevelopmentPath, +      "out/test-runner/mochaRunner" +    );      // Download VS Code, unzip it and run the integration test      await runTests({ extensionDevelopmentPath, extensionTestsPath }); diff --git a/extension/src/test-suite/environmentSetup.test.ts b/extension/src/test-suite/environmentSetup.test.ts index 9a478522..d0406340 100644 --- a/extension/src/test-suite/environmentSetup.test.ts +++ b/extension/src/test-suite/environmentSetup.test.ts @@ -2,18 +2,27 @@ import { test, describe } from "mocha";  import * as assert from "assert";  import { getContinueServerUrl } from "../bridge"; -import { startContinuePythonServer } from "../activation/environmentSetup"; +import { ideProtocolClient } from "../activation/activate";  import fetch from "node-fetch"; +import fkill from "fkill";  describe("Can start python server", () => {    test("Can start python server in under 10 seconds", async function () { -    this.timeout(17_000); -    await startContinuePythonServer(); +    const allowedTime = 25_000; +    this.timeout(allowedTime + 10_000); +    try { +      fkill(65432, { force: true, silent: true }); +      console.log("Killed existing server"); +    } catch (e) { +      console.log("No existing server: ", e); +    } -    await new Promise((resolve) => setTimeout(resolve, 15_000)); +    // If successful, the server is started by the extension while we wait +    await new Promise((resolve) => setTimeout(resolve, allowedTime));      // Check if server is running      const serverUrl = getContinueServerUrl(); +    console.log("Server URL: ", serverUrl);      const response = await fetch(`${serverUrl}/health`);      assert.equal(response.status, 200);    }); | 
