@@ -492,40 +492,34 @@ class ResourceLabelWidget extends IconLabel {
492
492
if ( ! options . forceLabel && ! isSideBySideEditor && resource ?. scheme === Schemas . vscodeNotebookCellOutput ) {
493
493
const notebookDocument = this . notebookDocumentService . getNotebook ( resource ) ;
494
494
const outputUriData = extractCellOutputDetails ( resource ) ;
495
-
496
- let cellIndex : number | undefined ;
497
- if ( ! outputUriData ?. notebook ) {
498
- return ;
499
- }
500
- if ( outputUriData . cellHandle ) {
501
- // if we have a cell handle, we can use that to get the cell index
495
+ if ( outputUriData ?. cellFragment ) {
496
+ if ( ! outputUriData . notebook ) {
497
+ return ;
498
+ }
502
499
const cellUri = outputUriData . notebook . with ( {
503
500
scheme : Schemas . vscodeNotebookCell ,
504
501
fragment : outputUriData . cellFragment
505
502
} ) ;
506
- cellIndex = notebookDocument ?. getCellIndex ( cellUri ) ;
507
- }
508
- const outputIndex = outputUriData . outputIndex ;
509
-
510
- if ( cellIndex !== undefined && outputIndex !== undefined && typeof label . name === 'string' ) {
511
- label . name = localize (
512
- 'notebookCellOutputLabel' ,
513
- "{0} • Cell {1} • Output {2}" ,
514
- label . name ,
515
- `${ cellIndex + 1 } ` ,
516
- `${ outputIndex + 1 } `
517
- ) ;
518
- } else if ( cellIndex !== undefined && typeof label . name === 'string' ) {
519
- label . name = localize (
520
- 'notebookCellOutputLabelSimple' ,
521
- "{0} • Cell {1} • Output" ,
522
- label . name ,
523
- `${ cellIndex + 1 } `
524
- ) ;
525
- } else if ( typeof label . name === 'string' ) {
526
- label . name = localize ( 'notebookCellOutputLabelJustFile' , "{0}" , label . name ) ;
503
+ const cellIndex = notebookDocument ?. getCellIndex ( cellUri ) ;
504
+ const outputIndex = outputUriData . outputIndex ;
505
+
506
+ if ( cellIndex !== undefined && outputIndex !== undefined && typeof label . name === 'string' ) {
507
+ label . name = localize (
508
+ 'notebookCellOutputLabel' ,
509
+ "{0} • Cell {1} • Output {2}" ,
510
+ label . name ,
511
+ `${ cellIndex + 1 } ` ,
512
+ `${ outputIndex + 1 } `
513
+ ) ;
514
+ } else if ( cellIndex !== undefined && typeof label . name === 'string' ) {
515
+ label . name = localize (
516
+ 'notebookCellOutputLabelSimple' ,
517
+ "{0} • Cell {1} • Output" ,
518
+ label . name ,
519
+ `${ cellIndex + 1 } `
520
+ ) ;
521
+ }
527
522
}
528
-
529
523
}
530
524
531
525
const hasResourceChanged = this . hasResourceChanged ( label ) ;
0 commit comments