@@ -2463,6 +2463,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
2463
2463
} else {
2464
2464
await this . revealInView ( cell ) ;
2465
2465
}
2466
+
2466
2467
}
2467
2468
2468
2469
}
@@ -2609,6 +2610,37 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
2609
2610
return Promise . all ( requests ) ;
2610
2611
}
2611
2612
2613
+ private async _warmupSelection ( includeOutput : boolean , selectedCellRanges : ICellRange [ ] ) {
2614
+ if ( ! this . hasModel ( ) || ! this . viewModel ) {
2615
+ return ;
2616
+ }
2617
+
2618
+ const cells = this . viewModel . viewCells ;
2619
+ const requests = [ ] ;
2620
+
2621
+ for ( const range of selectedCellRanges ) {
2622
+ for ( let i = range . start ; i < range . end ; i ++ ) {
2623
+ if ( cells [ i ] . cellKind === CellKind . Markup && ! this . _webview ! . markupPreviewMapping . has ( cells [ i ] . id ) ) {
2624
+ requests . push ( this . createMarkupPreview ( cells [ i ] ) ) ;
2625
+ }
2626
+ }
2627
+ }
2628
+
2629
+ if ( includeOutput && this . _list ) {
2630
+ for ( const range of selectedCellRanges ) {
2631
+ for ( let i = range . start ; i < range . end ; i ++ ) {
2632
+ const cell = this . _list . element ( i ) ;
2633
+
2634
+ if ( cell ?. cellKind === CellKind . Code ) {
2635
+ requests . push ( this . _warmupCell ( ( cell as CodeCellViewModel ) ) ) ;
2636
+ }
2637
+ }
2638
+ }
2639
+ }
2640
+
2641
+ return Promise . all ( requests ) ;
2642
+ }
2643
+
2612
2644
async find ( query : string , options : INotebookFindOptions , token : CancellationToken , skipWarmup : boolean = false , shouldGetSearchPreviewInfo = false , ownerID ?: string ) : Promise < CellFindMatchWithIndex [ ] > {
2613
2645
if ( ! this . _notebookViewModel ) {
2614
2646
return [ ] ;
@@ -2633,10 +2665,14 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
2633
2665
} ) ;
2634
2666
2635
2667
if ( this . _webview ) {
2636
- // request all outputs to be rendered
2668
+ // request all or some outputs to be rendered
2637
2669
// measure perf
2638
2670
const start = Date . now ( ) ;
2639
- await this . _warmupAll ( ! ! options . includeOutput ) ;
2671
+ if ( options . findScope && options . findScope . findScopeType === NotebookFindScopeType . Cells && options . findScope . selectedCellRanges ) {
2672
+ await this . _warmupSelection ( ! ! options . includeOutput , options . findScope . selectedCellRanges ) ;
2673
+ } else {
2674
+ await this . _warmupAll ( ! ! options . includeOutput ) ;
2675
+ }
2640
2676
const end = Date . now ( ) ;
2641
2677
this . logService . debug ( 'Find' , `Warmup time: ${ end - start } ms` ) ;
2642
2678
0 commit comments