From 04d591d0b2447abc9ed76ff588f2ae405001810e Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 28 Jun 2023 19:03:18 -0700 Subject: show UI before server loads with welcome msg --- extension/src/activation/activate.ts | 32 ++++++++++++++++---------------- extension/src/debugPanel.ts | 14 +++++++++----- 2 files changed, 25 insertions(+), 21 deletions(-) (limited to 'extension/src') diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts index 05589d92..cd8f0cf3 100644 --- a/extension/src/activation/activate.ts +++ b/extension/src/activation/activate.ts @@ -24,20 +24,6 @@ export async function activateExtension( registerAllCodeLensProviders(context); registerAllCommands(context); - 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); - } - ); - }); const serverUrl = getContinueServerUrl(); ideProtocolClient = new IdeProtocolClient( @@ -47,8 +33,8 @@ export async function activateExtension( // Setup the left panel (async () => { - const sessionId = await ideProtocolClient.getSessionId(); - const provider = new ContinueGUIWebviewViewProvider(sessionId); + const sessionIdPromise = ideProtocolClient.getSessionId(); + const provider = new ContinueGUIWebviewViewProvider(sessionIdPromise); context.subscriptions.push( vscode.window.registerWebviewViewProvider( @@ -61,6 +47,20 @@ export async function activateExtension( ); })(); + 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); + } + ); + }); // All opened terminals should be replaced by our own terminal // vscode.window.onDidOpenTerminal((terminal) => {}); diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index b0db590a..79719a3b 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -126,7 +126,7 @@ let streamManager = new StreamManager(); export let debugPanelWebview: vscode.Webview | undefined; export function setupDebugPanel( panel: vscode.WebviewPanel | vscode.WebviewView, - sessionId: string + sessionIdPromise: Promise ): string { debugPanelWebview = panel.webview; panel.onDidDispose(() => { @@ -224,6 +224,7 @@ export function setupDebugPanel( panel.webview.onDidReceiveMessage(async (data) => { switch (data.type) { case "onLoad": { + const sessionId = await sessionIdPromise; panel.webview.postMessage({ type: "onLoad", vscMachineId: vscode.env.machineId, @@ -334,10 +335,10 @@ export class ContinueGUIWebviewViewProvider implements vscode.WebviewViewProvider { public static readonly viewType = "continue.continueGUIView"; - private readonly sessionId: string; + private readonly sessionIdPromise: Promise; - constructor(sessionId: string) { - this.sessionId = sessionId; + constructor(sessionIdPromise: Promise) { + this.sessionIdPromise = sessionIdPromise; } resolveWebviewView( @@ -345,6 +346,9 @@ export class ContinueGUIWebviewViewProvider _context: vscode.WebviewViewResolveContext, _token: vscode.CancellationToken ): void | Thenable { - webviewView.webview.html = setupDebugPanel(webviewView, this.sessionId); + webviewView.webview.html = setupDebugPanel( + webviewView, + this.sessionIdPromise + ); } } -- cgit v1.2.3-70-g09d2