From 5f9be4eea7e4aafc315e7b4fcdb7cbabc36766db Mon Sep 17 00:00:00 2001 From: Heejae Chang <1333179+heejaechang@users.noreply.github.com> Date: Thu, 23 Mar 2023 21:52:34 -0700 Subject: [PATCH] Make sure we delay start pylance server (#20910) fixes https://github.com/microsoft/vscode-python/issues/20909 Activating `pylance` extension inside of `python` extension cause a dead lock since they have circular dependency. now we make sure we activate `pylance` once `python` extension is activated. `node` already works this way. it is just browser extension that started `pylance` inside `activate` directly. --- src/client/browser/extension.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/client/browser/extension.ts b/src/client/browser/extension.ts index 6ab6440bbe09..28e1912f67e4 100644 --- a/src/client/browser/extension.ts +++ b/src/client/browser/extension.ts @@ -20,13 +20,15 @@ interface BrowserConfig { let languageClient: LanguageClient | undefined; let pylanceApi: PylanceApi | undefined; -export async function activate(context: vscode.ExtensionContext): Promise { +export function activate(context: vscode.ExtensionContext): Promise { const reporter = getTelemetryReporter(); + const activationPromise = Promise.resolve(buildApi(reporter)); const pylanceExtension = vscode.extensions.getExtension(PYLANCE_EXTENSION_ID); if (pylanceExtension) { - await runPylance(context, pylanceExtension); - return buildApi(reporter); + // Make sure we run pylance once we activated core extension. + activationPromise.then(() => runPylance(context, pylanceExtension)); + return activationPromise; } const changeDisposable = vscode.extensions.onDidChange(async () => { @@ -37,7 +39,7 @@ export async function activate(context: vscode.ExtensionContext): Promise {