@@ -8,13 +8,11 @@ import {
88 workspace ,
99 NotebookControllerAffinity ,
1010 window ,
11- NotebookController ,
1211 CancellationTokenSource ,
1312 Disposable ,
1413 Uri ,
1514 l10n ,
1615 env ,
17- notebooks ,
1816 ProgressLocation ,
1917 QuickPickItem ,
2018 commands
@@ -50,6 +48,7 @@ import { DeepnoteKernelError } from '../../platform/errors/deepnoteKernelErrors'
5048import { DeepnoteEnvironment } from '../../kernels/deepnote/environments/deepnoteEnvironment' ;
5149import { STANDARD_OUTPUT_CHANNEL } from '../../platform/common/constants' ;
5250import { IOutputChannel } from '../../platform/common/types' ;
51+ import { createDeepnoteServerConfigHandle } from '../../platform/deepnote/deepnoteServerUtils.node' ;
5352
5453/**
5554 * Automatically selects and starts Deepnote kernel for .deepnote notebooks
@@ -62,8 +61,6 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
6261 private readonly notebookControllers = new Map < string , IVSCodeNotebookController > ( ) ;
6362 // Track connection metadata per notebook file for reuse
6463 private readonly notebookConnectionMetadata = new Map < string , DeepnoteKernelConnectionMetadata > ( ) ;
65- // Track temporary loading controllers that get disposed when real controller is ready
66- private readonly loadingControllers = new Map < string , NotebookController > ( ) ;
6764 // Track projects where we need to run init notebook (set during controller setup)
6865 private readonly projectsPendingInitNotebook = new Map <
6966 string ,
@@ -133,25 +130,26 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
133130 title : l10n . t ( 'Auto-selecting Deepnote kernel...' ) ,
134131 cancellable : false
135132 } ,
136- async ( progress , token ) => {
133+ // async (progress, token) => {
134+ async ( ) => {
137135 try {
138136 const result = await this . ensureKernelSelected ( notebook ) ;
139137 if ( ! result ) {
140- const selectedEnvironment = await this . pickEnvironment ( notebook . uri ) ;
141- if ( selectedEnvironment ) {
142- await this . notebookEnvironmentMapper . setEnvironmentForNotebook (
143- notebook . uri ,
144- selectedEnvironment . id
145- ) ;
146- await this . ensureKernelSelectedWithConfiguration (
147- notebook ,
148- selectedEnvironment ,
149- notebook . uri ,
150- notebook . uri . fsPath ,
151- progress ,
152- token
153- ) ;
154- }
138+ // const selectedEnvironment = await this.pickEnvironment(notebook.uri);
139+ // if (selectedEnvironment) {
140+ // await this.notebookEnvironmentMapper.setEnvironmentForNotebook(
141+ // notebook.uri,
142+ // selectedEnvironment.id
143+ // );
144+ // await this.ensureKernelSelectedWithConfiguration(
145+ // notebook,
146+ // selectedEnvironment,
147+ // notebook.uri,
148+ // notebook.uri.fsPath,
149+ // progress,
150+ // token
151+ // );
152+ // }
155153 }
156154 } catch ( error ) {
157155 logger . error ( `Failed to auto-select Deepnote kernel for ${ getDisplayPath ( notebook . uri ) } ` , error ) ;
@@ -459,6 +457,7 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
459457 const serverInfo = await this . serverStarter . startServer (
460458 configuration . pythonInterpreter ,
461459 configuration . venvPath ,
460+ configuration . packages ?? [ ] ,
462461 configuration . id ,
463462 baseFileUri ,
464463 progressToken
@@ -473,7 +472,7 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
473472 const serverProviderHandle : JupyterServerProviderHandle = {
474473 extensionId : JVSC_EXTENSION_ID ,
475474 id : 'deepnote-server' ,
476- handle : `deepnote-config-server- ${ configuration . id } - ${ baseFileUri . fsPath } `
475+ handle : createDeepnoteServerConfigHandle ( configuration . id , baseFileUri )
477476 } ;
478477
479478 // Register the server with the provider
@@ -643,7 +642,7 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
643642 return ;
644643 }
645644
646- const expectedHandle = `deepnote-config-server- ${ environmentId } ` ;
645+ const expectedHandle = createDeepnoteServerConfigHandle ( environmentId , notebook . uri ) ;
647646
648647 if ( selectedController . connection . serverProviderHandle . handle === expectedHandle ) {
649648 // Unselect the controller by setting affinity to Default
@@ -654,31 +653,6 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
654653 }
655654 }
656655
657- private createLoadingController ( notebook : NotebookDocument , notebookKey : string ) : void {
658- // Create a temporary controller that shows "Loading..." and prevents kernel selection prompt
659- const loadingController = notebooks . createNotebookController (
660- `deepnote-loading-${ notebookKey } ` ,
661- DEEPNOTE_NOTEBOOK_TYPE ,
662- l10n . t ( 'Loading Deepnote Kernel...' )
663- ) ;
664-
665- // Set it as the preferred controller immediately
666- loadingController . supportsExecutionOrder = false ;
667- loadingController . supportedLanguages = [ 'python' ] ;
668-
669- // Execution handler that does nothing - cells will just sit there until real kernel is ready
670- loadingController . executeHandler = ( ) => {
671- // No-op: execution is blocked until the real controller takes over
672- } ;
673-
674- // Select this controller for the notebook
675- loadingController . updateNotebookAffinity ( notebook , NotebookControllerAffinity . Preferred ) ;
676-
677- // Store it so we can dispose it later
678- this . loadingControllers . set ( notebookKey , loadingController ) ;
679- logger . info ( `Created loading controller for ${ notebookKey } ` ) ;
680- }
681-
682656 /**
683657 * Handle kernel selection errors with user-friendly messages and actions
684658 */
0 commit comments