Skip to content

Commit 5f9be4e

Browse files
authored
Make sure we delay start pylance server (#20910)
fixes #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.
1 parent be55c97 commit 5f9be4e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/client/browser/extension.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ interface BrowserConfig {
2020
let languageClient: LanguageClient | undefined;
2121
let pylanceApi: PylanceApi | undefined;
2222

23-
export async function activate(context: vscode.ExtensionContext): Promise<IBrowserExtensionApi> {
23+
export function activate(context: vscode.ExtensionContext): Promise<IBrowserExtensionApi> {
2424
const reporter = getTelemetryReporter();
2525

26+
const activationPromise = Promise.resolve(buildApi(reporter));
2627
const pylanceExtension = vscode.extensions.getExtension<PylanceApi>(PYLANCE_EXTENSION_ID);
2728
if (pylanceExtension) {
28-
await runPylance(context, pylanceExtension);
29-
return buildApi(reporter);
29+
// Make sure we run pylance once we activated core extension.
30+
activationPromise.then(() => runPylance(context, pylanceExtension));
31+
return activationPromise;
3032
}
3133

3234
const changeDisposable = vscode.extensions.onDidChange(async () => {
@@ -37,7 +39,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<IBrows
3739
}
3840
});
3941

40-
return buildApi(reporter);
42+
return activationPromise;
4143
}
4244

4345
export async function deactivate(): Promise<void> {

0 commit comments

Comments
 (0)