From 699a74250fd4cf91af930ff63077aeb81f74856f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 13 Jul 2023 09:55:09 -0700 Subject: show react immediately --- extension/src/activation/activate.ts | 72 ++++++++++++++++++------------------ extension/src/bridge.ts | 6 +-- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index cd885b12..b03282e5 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -35,46 +35,48 @@ export async function activateExtension(context: vscode.ExtensionContext) { }) .catch((e) => console.log("Error checking for extension updates: ", e)); - // Start the Python server - await new Promise((resolve, reject) => { - vscode.window.withProgress( + const sessionIdPromise = (async () => { + // Start the Python server + await new Promise((resolve, reject) => { + 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) => { + await startContinuePythonServer(); + resolve(null); + } + ); + }); + + // Initialize IDE Protocol Client + const serverUrl = getContinueServerUrl(); + ideProtocolClient = new IdeProtocolClient( + `${serverUrl.replace("http", "ws")}/ide/ws`, + context + ); + + return ideProtocolClient.getSessionId(); + })(); + + // Register the webview + const provider = new ContinueGUIWebviewViewProvider(sessionIdPromise); + + context.subscriptions.push( + vscode.window.registerWebviewViewProvider( + "continue.continueGUIView", + provider, { - location: vscode.ProgressLocation.Notification, - title: - "Starting Continue Server... (it may take a minute to download Python packages)", - cancellable: false, - }, - async (progress, token) => { - await startContinuePythonServer(); - resolve(null); + webviewOptions: { retainContextWhenHidden: true }, } - ); - }); + ) + ); // Register commands and providers sendTelemetryEvent(TelemetryEvent.ExtensionActivated); registerAllCodeLensProviders(context); registerAllCommands(context); - - // Initialize IDE Protocol Client - const serverUrl = getContinueServerUrl(); - ideProtocolClient = new IdeProtocolClient( - `${serverUrl.replace("http", "ws")}/ide/ws`, - context - ); - - { - const sessionIdPromise = await ideProtocolClient.getSessionId(); - const provider = new ContinueGUIWebviewViewProvider(sessionIdPromise); - - context.subscriptions.push( - vscode.window.registerWebviewViewProvider( - "continue.continueGUIView", - provider, - { - webviewOptions: { retainContextWhenHidden: true }, - } - ) - ); - } } diff --git a/extension/src/bridge.ts b/extension/src/bridge.ts index 7e6398be..d614ace4 100644 --- a/extension/src/bridge.ts +++ b/extension/src/bridge.ts @@ -1,11 +1,7 @@ import fetch from "node-fetch"; import * as path from "path"; import * as vscode from "vscode"; -import { - Configuration, - DebugApi, - UnittestApi, -} from "./client"; +import { Configuration, DebugApi, UnittestApi } from "./client"; import { convertSingleToDoubleQuoteJSON } from "./util/util"; import { getExtensionUri } from "./util/vscode"; import { extensionContext } from "./activation/activate"; -- cgit v1.2.3-70-g09d2 From 9ed9c2dc9ee0a0ebbb79278109df6b2413688adf Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 24 Jul 2023 01:04:51 -0700 Subject: activation events * to load faster --- extension/package.json | 3 +-- extension/src/debugPanel.ts | 13 ------------- 2 files changed, 1 insertion(+), 15 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/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("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": { -- cgit v1.2.3-70-g09d2 From f3805d769c5c14bb8fbe2e33c7cdfe2a918cbd4a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Mon, 24 Jul 2023 01:07:05 -0700 Subject: cleaning --- extension/src/activation/activate.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 0c6e6009..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,9 +7,6 @@ import { startContinuePythonServer, } from "./environmentSetup"; import fetch from "node-fetch"; -import registerQuickFixProvider from "../lang-server/codeActions"; -import { get } from "http"; -// import { CapturedTerminal } from "../terminal/terminalEmulator"; const PACKAGE_JSON_RAW_GITHUB_URL = "https://raw.githubusercontent.com/continuedev/continue/HEAD/extension/package.json"; -- cgit v1.2.3-70-g09d2