File tree Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Original file line number Diff line number Diff 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
262272function isJupyterResource ( resource : Uri ) : boolean {
You can’t perform that action at this time.
0 commit comments