Skip to content

Commit 03e5a10

Browse files
committed
wip
1 parent 862bd66 commit 03e5a10

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/client/jupyter/jupyterIntegration.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,32 @@ export class JupyterExtensionPythonEnvironments extends DisposableBase implement
241241

242242
private getJupyterApi() {
243243
if (!this.jupyterExtension) {
244-
const api = this.extensions.getExtension<JupyterPythonEnvironmentApi>(JUPYTER_EXTENSION_ID)?.exports;
245-
if (!api) {
244+
const ext = this.extensions.getExtension<JupyterPythonEnvironmentApi>(JUPYTER_EXTENSION_ID);
245+
if (!ext) {
246246
return undefined;
247247
}
248-
this.jupyterExtension = api;
249-
if (api.onDidChangePythonEnvironment) {
250-
this._register(
251-
api.onDidChangePythonEnvironment(
252-
this._onDidChangePythonEnvironment.fire,
253-
this._onDidChangePythonEnvironment,
254-
),
255-
);
248+
if (!ext.isActive) {
249+
ext.activate().then(() => {
250+
this.hookupOnDidChangePythonEnvironment(ext.exports);
251+
});
252+
return undefined;
256253
}
254+
this.hookupOnDidChangePythonEnvironment(ext.exports);
257255
}
258256
return this.jupyterExtension;
259257
}
258+
259+
private hookupOnDidChangePythonEnvironment(api: JupyterPythonEnvironmentApi) {
260+
this.jupyterExtension = api;
261+
if (api.onDidChangePythonEnvironment) {
262+
this._register(
263+
api.onDidChangePythonEnvironment(
264+
this._onDidChangePythonEnvironment.fire,
265+
this._onDidChangePythonEnvironment,
266+
),
267+
);
268+
}
269+
}
260270
}
261271

262272
function isJupyterResource(resource: Uri): boolean {

0 commit comments

Comments
 (0)