File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed
src/vs/workbench/contrib/notebook/browser Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -3065,12 +3065,16 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
3065
3065
const cell = this . viewModel ?. viewCells . find ( vc => vc . handle === cellInfo . cellHandle ) ;
3066
3066
if ( cell && cell instanceof CodeCellViewModel ) {
3067
3067
const outputIndex = cell . outputsViewModels . indexOf ( output ) ;
3068
- this . _debug ( 'update cell output' , cell . handle , outputHeight ) ;
3069
- cell . updateOutputHeight ( outputIndex , outputHeight , source ) ;
3070
- this . layoutNotebookCell ( cell , cell . layoutInfo . totalHeight ) ;
3068
+ if ( outputIndex > - 1 ) {
3069
+ this . _debug ( 'update cell output' , cell . handle , outputHeight ) ;
3070
+ cell . updateOutputHeight ( outputIndex , outputHeight , source ) ;
3071
+ this . layoutNotebookCell ( cell , cell . layoutInfo . totalHeight ) ;
3071
3072
3072
- if ( isInit ) {
3073
- this . _onDidRenderOutput . fire ( output ) ;
3073
+ if ( isInit ) {
3074
+ this . _onDidRenderOutput . fire ( output ) ;
3075
+ }
3076
+ } else {
3077
+ this . _debug ( 'tried to update cell output that does not exist' ) ;
3074
3078
}
3075
3079
}
3076
3080
}
Original file line number Diff line number Diff line change @@ -446,10 +446,16 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
446
446
447
447
this . _ensureOutputsTop ( ) ;
448
448
449
- if ( index === 0 || height > 0 ) {
450
- this . _outputViewModels [ index ] . setVisible ( true ) ;
451
- } else if ( height === 0 ) {
452
- this . _outputViewModels [ index ] . setVisible ( false ) ;
449
+ try {
450
+ if ( index === 0 || height > 0 ) {
451
+ this . _outputViewModels [ index ] . setVisible ( true ) ;
452
+ } else if ( height === 0 ) {
453
+ this . _outputViewModels [ index ] . setVisible ( false ) ;
454
+ }
455
+ } catch ( e ) {
456
+ const errorMessage = `Failed to update output height for cell ${ this . handle } , output ${ index } . `
457
+ + `this.outputCollection.length: ${ this . _outputCollection . length } , this._outputViewModels.length: ${ this . _outputViewModels . length } ` ;
458
+ throw new Error ( `${ errorMessage } .\n Error: ${ e . message } ` ) ;
453
459
}
454
460
455
461
if ( this . _outputViewModels [ index ] . visible . get ( ) && height < 28 ) {
You can’t perform that action at this time.
0 commit comments