diff options
| author | Nate Sesti <33237525+sestinj@users.noreply.github.com> | 2023-07-24 01:07:23 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-24 01:07:23 -0700 | 
| commit | f090dce8cc10ba08356f54158ed33a28f1a505b9 (patch) | |
| tree | 098fbe5657149c7ca6eba3d812b8c19c33250529 | |
| parent | 885f88af1d7b35e03b1de4df3e74a60da1a777ed (diff) | |
| parent | f3805d769c5c14bb8fbe2e33c7cdfe2a918cbd4a (diff) | |
| download | sncontinue-f090dce8cc10ba08356f54158ed33a28f1a505b9.tar.gz sncontinue-f090dce8cc10ba08356f54158ed33a28f1a505b9.tar.bz2 sncontinue-f090dce8cc10ba08356f54158ed33a28f1a505b9.zip | |
Merge pull request #294 from continuedev/show-react-immediately
Show react immediately
| -rw-r--r-- | extension/package.json | 3 | ||||
| -rw-r--r-- | extension/src/activation/activate.ts | 102 | ||||
| -rw-r--r-- | extension/src/debugPanel.ts | 13 | 
3 files changed, 50 insertions, 68 deletions
| diff --git a/extension/package.json b/extension/package.json index 884b518c..4eca6e68 100644 --- a/extension/package.json +++ b/extension/package.json @@ -35,8 +35,7 @@      "chat"    ],    "activationEvents": [ -    "onStartupFinished", -    "onView:continueGUIView" +    "*"    ],    "main": "./out/extension.js",    "browser": "./out/extension.js", diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 65f026d8..a1d88a31 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -1,6 +1,4 @@  import * as vscode from "vscode"; -import { registerAllCommands } from "../commands"; -import { registerAllCodeLensProviders } from "../lang-server/codeLens";  import IdeProtocolClient from "../continueIdeClient";  import { getContinueServerUrl } from "../bridge";  import { ContinueGUIWebviewViewProvider } from "../debugPanel"; @@ -9,8 +7,6 @@ import {    startContinuePythonServer,  } from "./environmentSetup";  import fetch from "node-fetch"; -import registerQuickFixProvider from "../lang-server/codeActions"; -// import { CapturedTerminal } from "../terminal/terminalEmulator";  const PACKAGE_JSON_RAW_GITHUB_URL =    "https://raw.githubusercontent.com/continuedev/continue/HEAD/extension/package.json"; @@ -36,60 +32,60 @@ export async function activateExtension(context: vscode.ExtensionContext) {      .catch((e) => console.log("Error checking for extension updates: ", e));    // Start the server and display loader if taking > 2 seconds -  await new Promise((resolve) => { -    let serverStarted = false; +  const sessionIdPromise = (async () => { +    await new Promise((resolve) => { +      let serverStarted = false; -    // Start the server and set serverStarted to true when done -    startContinuePythonServer().then(() => { -      serverStarted = true; -      resolve(null); -    }); +      // Start the server and set serverStarted to true when done +      startContinuePythonServer().then(() => { +        serverStarted = true; +        resolve(null); +      }); -    // Wait for 2 seconds -    setTimeout(() => { -      // If the server hasn't started after 2 seconds, show the notification -      if (!serverStarted) { -        vscode.window.withProgress( -          { -            location: vscode.ProgressLocation.Notification, -            title: -              "Starting Continue Server... (it may take a minute to download Python packages)", -            cancellable: false, -          }, -          async (progress, token) => { -            // Wait for the server to start -            while (!serverStarted) { -              await new Promise((innerResolve) => -                setTimeout(innerResolve, 1000) -              ); +      // Wait for 2 seconds +      setTimeout(() => { +        // If the server hasn't started after 2 seconds, show the notification +        if (!serverStarted) { +          vscode.window.withProgress( +            { +              location: vscode.ProgressLocation.Notification, +              title: +                "Starting Continue Server... (it may take a minute to download Python packages)", +              cancellable: false, +            }, +            async (progress, token) => { +              // Wait for the server to start +              while (!serverStarted) { +                await new Promise((innerResolve) => +                  setTimeout(innerResolve, 1000) +                ); +              } +              return Promise.resolve();              } -            return Promise.resolve(); -          } -        ); -      } -    }, 2000); -  }); +          ); +        } +      }, 2000); +    }); -  // Initialize IDE Protocol Client -  const serverUrl = getContinueServerUrl(); -  ideProtocolClient = new IdeProtocolClient( -    `${serverUrl.replace("http", "ws")}/ide/ws`, -    context -  ); +    // Initialize IDE Protocol Client +    const serverUrl = getContinueServerUrl(); +    ideProtocolClient = new IdeProtocolClient( +      `${serverUrl.replace("http", "ws")}/ide/ws`, +      context +    ); +    return await ideProtocolClient.getSessionId(); +  })();    // Register Continue GUI as sidebar webview, and beging a new session -  { -    const sessionIdPromise = await ideProtocolClient.getSessionId(); -    const provider = new ContinueGUIWebviewViewProvider(sessionIdPromise); +  const provider = new ContinueGUIWebviewViewProvider(sessionIdPromise); -    context.subscriptions.push( -      vscode.window.registerWebviewViewProvider( -        "continue.continueGUIView", -        provider, -        { -          webviewOptions: { retainContextWhenHidden: true }, -        } -      ) -    ); -  } +  context.subscriptions.push( +    vscode.window.registerWebviewViewProvider( +      "continue.continueGUIView", +      provider, +      { +        webviewOptions: { retainContextWhenHidden: true }, +      } +    ) +  );  } diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index dd24a8d8..f97cf846 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -181,19 +181,6 @@ export function setupDebugPanel(              .getConfiguration("continue")              .get<boolean>("dataSwitch"),          }); - -        // // Listen for changes to server URL in settings -        // vscode.workspace.onDidChangeConfiguration((event) => { -        //   if (event.affectsConfiguration("continue.serverUrl")) { -        //     debugPanelWebview?.postMessage({ -        //       type: "onLoad", -        //       vscMachineId: vscode.env.machineId, -        //       apiUrl: getContinueServerUrl(), -        //       sessionId, -        //     }); -        //   } -        // }); -          break;        }        case "toggleDataSwitch": { | 
