summaryrefslogtreecommitdiff
path: root/extension/src/activation/activate.ts
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-13 09:55:09 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-13 09:55:09 -0700
commit699a74250fd4cf91af930ff63077aeb81f74856f (patch)
tree38be66ac1c9cb2d593927200a5fc363405cc1593 /extension/src/activation/activate.ts
parentf0ce0ad4537aadb8252cebd1b5ce25a91c60e392 (diff)
downloadsncontinue-699a74250fd4cf91af930ff63077aeb81f74856f.tar.gz
sncontinue-699a74250fd4cf91af930ff63077aeb81f74856f.tar.bz2
sncontinue-699a74250fd4cf91af930ff63077aeb81f74856f.zip
show react immediately
Diffstat (limited to 'extension/src/activation/activate.ts')
-rw-r--r--extension/src/activation/activate.ts72
1 files changed, 37 insertions, 35 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 },
- }
- )
- );
- }
}