@@ -34,6 +34,7 @@ import { CellContextKeyManager } from 'vs/workbench/contrib/notebook/browser/vie
34
34
import { CellDecorations } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations' ;
35
35
import { CellDragAndDropController } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd' ;
36
36
import { CellEditorOptions } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions' ;
37
+ import { CellExecutionPart } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution' ;
37
38
import { CellFocusIndicator } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator' ;
38
39
import { CellProgressBar } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar' ;
39
40
import { BetweenCellToolbar , CellTitleToolbarPart } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars' ;
@@ -45,7 +46,7 @@ import { BaseCellRenderTemplate, CodeCellRenderTemplate, MarkdownCellRenderTempl
45
46
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel' ;
46
47
import { MarkupCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel' ;
47
48
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel' ;
48
- import { CellKind , NotebookCellInternalMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
49
+ import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
49
50
50
51
const $ = DOM . $ ;
51
52
@@ -462,11 +463,11 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
462
463
progressBar,
463
464
statusBar,
464
465
focusIndicator : new CellFocusIndicator ( this . notebookEditor , focusIndicatorTop , focusIndicatorLeft , focusIndicatorRight , focusIndicatorBottom ) ,
466
+ cellExecution : new CellExecutionPart ( this . notebookEditor , executionOrderLabel ) ,
465
467
titleToolbar,
466
468
betweenCellToolbar,
467
469
focusSinkElement,
468
470
runToolbar,
469
- executionOrderLabel,
470
471
outputContainer,
471
472
outputShowMoreContainer,
472
473
editor,
@@ -487,12 +488,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
487
488
}
488
489
} ) ) ;
489
490
490
- templateDisposables . add ( this . notebookEditor . onDidChangeActiveKernel ( ( ) => {
491
- if ( templateData . currentRenderedCell ) {
492
- this . updateForKernel ( templateData . currentRenderedCell as CodeCellViewModel , templateData ) ;
493
- }
494
- } ) ) ;
495
-
491
+ templateData . cellExecution . setup ( templateData ) ;
496
492
this . commonRenderTemplate ( templateData ) ;
497
493
498
494
return templateData ;
@@ -582,30 +578,6 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
582
578
return combinedDisposable ( dragHandleListener , collapsedPartListener , clickHandler ) ;
583
579
}
584
580
585
- private updateForInternalMetadata ( element : CodeCellViewModel , templateData : CodeCellRenderTemplate ) : void {
586
- if ( ! this . notebookEditor . hasModel ( ) ) {
587
- return ;
588
- }
589
-
590
- const internalMetadata = element . internalMetadata ;
591
- this . updateExecutionOrder ( internalMetadata , templateData ) ;
592
- }
593
-
594
- private updateForKernel ( element : CodeCellViewModel , templateData : CodeCellRenderTemplate ) : void {
595
- this . updateExecutionOrder ( element . internalMetadata , templateData ) ;
596
- }
597
-
598
- private updateExecutionOrder ( internalMetadata : NotebookCellInternalMetadata , templateData : CodeCellRenderTemplate ) : void {
599
- if ( this . notebookEditor . activeKernel ?. implementsExecutionOrder ) {
600
- const executionOrderLabel = typeof internalMetadata . executionOrder === 'number' ?
601
- `[${ internalMetadata . executionOrder } ]` :
602
- '[ ]' ;
603
- templateData . executionOrderLabel . innerText = executionOrderLabel ;
604
- } else {
605
- templateData . executionOrderLabel . innerText = '' ;
606
- }
607
- }
608
-
609
581
private updateForLayout ( element : CodeCellViewModel , templateData : CodeCellRenderTemplate ) : void {
610
582
templateData . elementDisposables . add ( DOM . scheduleAtNextAnimationFrame ( ( ) => {
611
583
const bottomToolbarDimensions = this . notebookEditor . notebookOptions . computeBottomToolbarDimensions ( this . notebookEditor . textModel ?. viewType ) ;
@@ -618,6 +590,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
618
590
619
591
this . updateForTitleMenu ( templateData ) ;
620
592
templateData . betweenCellToolbar . updateLayoutNow ( element ) ;
593
+
594
+ templateData . cellExecution . updateLayoutNow ( element ) ;
621
595
} ) ) ;
622
596
}
623
597
@@ -658,7 +632,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
658
632
templateData . progressBar ,
659
633
templateData . titleToolbar ,
660
634
templateData . runToolbar ,
661
- cellEditorOptions
635
+ cellEditorOptions ,
636
+ templateData . cellExecution ,
662
637
] ) ) ;
663
638
664
639
this . renderedEditors . set ( element , templateData . editor ) ;
@@ -672,16 +647,6 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
672
647
this . updateForLayout ( element , templateData ) ;
673
648
} ) ) ;
674
649
675
- this . updateForInternalMetadata ( element , templateData ) ;
676
-
677
- elementDisposables . add ( element . onDidChangeState ( ( e ) => {
678
- if ( e . metadataChanged || e . internalMetadataChanged ) {
679
- this . updateForInternalMetadata ( element , templateData ) ;
680
- }
681
- } ) ) ;
682
-
683
- this . updateForKernel ( element , templateData ) ;
684
-
685
650
templateData . elementDisposables . add ( templateData . titleToolbar . onDidUpdateActions ( ( ) => {
686
651
// Don't call directly here - is initially called by updateForLayout in the next frame
687
652
this . updateForTitleMenu ( templateData ) ;
0 commit comments