@@ -56,9 +56,6 @@ import { IListContextMenuEvent } from 'vs/base/browser/ui/list/list';
5656import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
5757import { IMenuService , MenuId } from 'vs/platform/actions/common/actions' ;
5858import { IAction , Separator } from 'vs/base/common/actions' ;
59- import { isMacintosh , isNative } from 'vs/base/common/platform' ;
60- import { getTitleBarStyle } from 'vs/platform/windows/common/windows' ;
61- import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
6259import { CellDragAndDropController } from 'vs/workbench/contrib/notebook/browser/view/renderers/dnd' ;
6360
6461const $ = DOM . $ ;
@@ -222,7 +219,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
222219 @IStorageService storageService : IStorageService ,
223220 @INotebookService private notebookService : INotebookService ,
224221 @IConfigurationService private readonly configurationService : IConfigurationService ,
225- @IEnvironmentService private readonly environmentService : IEnvironmentService ,
226222 @IContextKeyService readonly contextKeyService : IContextKeyService ,
227223 @ILayoutService private readonly layoutService : ILayoutService ,
228224 @IContextMenuService private readonly contextMenuService : IContextMenuService ,
@@ -704,25 +700,14 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
704700 return ;
705701 }
706702
707- if ( provider . kernel && ( availableKernels . length + availableKernels2 . length ) > 0 ) {
708- this . _notebookHasMultipleKernels ! . set ( true ) ;
709- this . multipleKernelsAvailable = true ;
710- } else if ( ( availableKernels . length + availableKernels2 . length ) > 1 ) {
703+ if ( ( availableKernels . length + availableKernels2 . length ) > 1 ) {
711704 this . _notebookHasMultipleKernels ! . set ( true ) ;
712705 this . multipleKernelsAvailable = true ;
713706 } else {
714707 this . _notebookHasMultipleKernels ! . set ( false ) ;
715708 this . multipleKernelsAvailable = false ;
716709 }
717710
718- // @deprecated
719- if ( provider && provider . kernel ) {
720- // it has a builtin kernel, don't automatically choose a kernel
721- await this . _loadKernelPreloads ( provider . providerExtensionLocation , provider . kernel ) ;
722- tokenSource . dispose ( ) ;
723- return ;
724- }
725-
726711 const activeKernelStillExist = [ ...availableKernels2 , ...availableKernels ] . find ( kernel => kernel . id === this . activeKernel ?. id && this . activeKernel ?. id !== undefined ) ;
727712
728713 if ( activeKernelStillExist ) {
@@ -1429,15 +1414,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
14291414
14301415 private async _cancelNotebookExecution ( ) : Promise < void > {
14311416 const provider = this . notebookService . getContributedNotebookProviders ( this . viewModel ! . uri ) [ 0 ] ;
1432- if ( provider ) {
1433- const viewType = provider . id ;
1434- const notebookUri = this . _notebookViewModel ! . uri ;
1435-
1436- if ( this . _activeKernel ) {
1437- await ( this . _activeKernel as INotebookKernelInfo2 ) . cancelNotebookCell ! ( this . _notebookViewModel ! . uri , undefined ) ;
1438- } else if ( provider . kernel ) {
1439- return await this . notebookService . cancelNotebook ( viewType , notebookUri ) ;
1440- }
1417+ if ( provider && this . _activeKernel ) {
1418+ await ( this . _activeKernel as INotebookKernelInfo2 ) . cancelNotebookCell ! ( this . _notebookViewModel ! . uri , undefined ) ;
14411419 }
14421420 }
14431421
@@ -1451,23 +1429,16 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
14511429
14521430 private async _executeNotebook ( ) : Promise < void > {
14531431 const provider = this . notebookService . getContributedNotebookProviders ( this . viewModel ! . uri ) [ 0 ] ;
1454- if ( provider ) {
1455- const viewType = provider . id ;
1456- const notebookUri = this . _notebookViewModel ! . uri ;
1457-
1458- if ( this . _activeKernel ) {
1459- // TODO@rebornix temp any cast, should be removed once we remove legacy kernel support
1460- if ( ( this . _activeKernel as INotebookKernelInfo2 ) . executeNotebookCell ) {
1461- if ( this . _activeKernelResolvePromise ) {
1462- await this . _activeKernelResolvePromise ;
1463- }
1464-
1465- await ( this . _activeKernel as INotebookKernelInfo2 ) . executeNotebookCell ! ( this . _notebookViewModel ! . uri , undefined ) ;
1466- } else {
1467- await this . notebookService . executeNotebook2 ( this . _notebookViewModel ! . viewType , this . _notebookViewModel ! . uri , this . _activeKernel . id ) ;
1432+ if ( provider && this . _activeKernel ) {
1433+ // TODO@rebornix temp any cast, should be removed once we remove legacy kernel support
1434+ if ( ( this . _activeKernel as INotebookKernelInfo2 ) . executeNotebookCell ) {
1435+ if ( this . _activeKernelResolvePromise ) {
1436+ await this . _activeKernelResolvePromise ;
14681437 }
1469- } else if ( provider . kernel ) {
1470- return await this . notebookService . executeNotebook ( viewType , notebookUri ) ;
1438+
1439+ await ( this . _activeKernel as INotebookKernelInfo2 ) . executeNotebookCell ! ( this . _notebookViewModel ! . uri , undefined ) ;
1440+ } else {
1441+ await this . notebookService . executeNotebook2 ( this . _notebookViewModel ! . viewType , this . _notebookViewModel ! . uri , this . _activeKernel . id ) ;
14711442 }
14721443 }
14731444 }
@@ -1491,15 +1462,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
14911462
14921463 private async _cancelNotebookCell ( cell : ICellViewModel ) : Promise < void > {
14931464 const provider = this . notebookService . getContributedNotebookProviders ( this . viewModel ! . uri ) [ 0 ] ;
1494- if ( provider ) {
1495- const viewType = provider . id ;
1496- const notebookUri = this . _notebookViewModel ! . uri ;
1497-
1498- if ( this . _activeKernel ) {
1499- return await ( this . _activeKernel as INotebookKernelInfo2 ) . cancelNotebookCell ! ( this . _notebookViewModel ! . uri , cell . handle ) ;
1500- } else if ( provider . kernel ) {
1501- return await this . notebookService . cancelNotebookCell ( viewType , notebookUri , cell . handle ) ;
1502- }
1465+ if ( provider && this . _activeKernel ) {
1466+ return await ( this . _activeKernel as INotebookKernelInfo2 ) . cancelNotebookCell ! ( this . _notebookViewModel ! . uri , cell . handle ) ;
15031467 }
15041468 }
15051469
@@ -1530,9 +1494,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
15301494
15311495 return await this . notebookService . executeNotebookCell2 ( viewType , notebookUri , cell . handle , this . _activeKernel . id ) ;
15321496 }
1533- } else if ( provider . kernel ) {
1534- return await this . notebookService . executeNotebookCell ( viewType , notebookUri , cell . handle ) ;
15351497 }
1498+
15361499 }
15371500 }
15381501
0 commit comments