diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-13 09:55:09 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-13 09:55:09 -0700 |
commit | 59c549a468abd40207f8dc46eacdc0e02bbe21ad (patch) | |
tree | 1e9f82ea1d5dc0e3a083f80487da629ca1a0a536 /extension/src | |
parent | c761f3b56785fbdbbb157e8106c6b5820518992d (diff) | |
download | sncontinue-59c549a468abd40207f8dc46eacdc0e02bbe21ad.tar.gz sncontinue-59c549a468abd40207f8dc46eacdc0e02bbe21ad.tar.bz2 sncontinue-59c549a468abd40207f8dc46eacdc0e02bbe21ad.zip |
show react immediately
Diffstat (limited to 'extension/src')
-rw-r--r-- | extension/src/activation/activate.ts | 72 | ||||
-rw-r--r-- | 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"; |