@@ -492,31 +492,33 @@ 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
- if ( ! outputUriData ?. notebook || ! outputUriData . cellFragment ) {
496
- return ;
497
- }
498
- const cellUri = outputUriData . notebook . with ( {
499
- scheme : Schemas . vscodeNotebookCell ,
500
- fragment : outputUriData . cellFragment
501
- } ) ;
502
- const cellIndex = notebookDocument ?. getCellIndex ( cellUri ) ;
503
- const outputIndex = outputUriData . outputIndex ;
504
-
505
- if ( cellIndex !== undefined && outputIndex !== undefined && typeof label . name === 'string' ) {
506
- label . name = localize (
507
- 'notebookCellOutputLabel' ,
508
- "{0} • Cell {1} • Output {2}" ,
509
- label . name ,
510
- `${ cellIndex + 1 } ` ,
511
- `${ outputIndex + 1 } `
512
- ) ;
513
- } else if ( cellIndex !== undefined && typeof label . name === 'string' ) {
514
- label . name = localize (
515
- 'notebookCellOutputLabelSimple' ,
516
- "{0} • Cell {1} • Output" ,
517
- label . name ,
518
- `${ cellIndex + 1 } `
519
- ) ;
495
+ if ( outputUriData ?. cellFragment ) {
496
+ if ( ! outputUriData . notebook ) {
497
+ return ;
498
+ }
499
+ const cellUri = outputUriData . notebook . with ( {
500
+ scheme : Schemas . vscodeNotebookCell ,
501
+ fragment : outputUriData . cellFragment
502
+ } ) ;
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
+ }
520
522
}
521
523
}
522
524
0 commit comments