File tree Expand file tree Collapse file tree
src/vs/workbench/contrib/notebook/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1497,3 +1497,16 @@ registerAction2(class extends NotebookCellAction {
14971497 context . notebookEditor . viewModel ! . notebookDocument . changeCellMetadata ( context . cell . handle , { inputCollapsed : false } ) ;
14981498 }
14991499} ) ;
1500+
1501+ registerAction2 ( class extends NotebookCellAction {
1502+ constructor ( ) {
1503+ super ( {
1504+ id : 'notebook.inspectLayout' ,
1505+ title : localize ( 'notebookActions.inspectLayout' , "Inspect Layout" )
1506+ } ) ;
1507+ }
1508+
1509+ async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
1510+ context . notebookEditor . viewModel ! . inspectLayout ( ) ;
1511+ }
1512+ } ) ;
Original file line number Diff line number Diff line change @@ -344,6 +344,13 @@ export class BackLayerWebView extends Disposable {
344344 return ;
345345 }
346346
347+ const cell = this . insetMapping . get ( output ) ! . cell ;
348+
349+ const currCell = this . notebookEditor . viewModel ?. viewCells . find ( vc => vc . handle === cell . handle ) ;
350+ if ( currCell !== cell && currCell !== undefined ) {
351+ this . insetMapping . get ( output ) ! . cell = currCell as CodeCellViewModel ;
352+ }
353+
347354 return { cell : this . insetMapping . get ( output ) ! . cell , output } ;
348355 }
349356
Original file line number Diff line number Diff line change @@ -449,6 +449,15 @@ function webviewPreloads() {
449449 if ( output ) {
450450 output . parentElement ! . style . display = 'block' ;
451451 output . style . top = top + 'px' ;
452+
453+ vscode . postMessage ( {
454+ __vscode_notebook_message : true ,
455+ type : 'dimension' ,
456+ id : outputId ,
457+ data : {
458+ height : output . clientHeight
459+ }
460+ } ) ;
452461 }
453462 } ) ;
454463 break ;
Original file line number Diff line number Diff line change @@ -349,6 +349,16 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
349349 } ) ;
350350 }
351351
352+ inspectLayout ( ) {
353+ console . log ( '--- notebook ---\n' ) ;
354+ console . log ( this . layoutInfo ) ;
355+ console . log ( '--- cells ---' ) ;
356+ this . viewCells . forEach ( cell => {
357+ console . log ( `--- cell: ${ cell . handle } ---\n` ) ;
358+ console . log ( ( cell as ( CodeCellViewModel | MarkdownCellViewModel ) ) . layoutInfo ) ;
359+ } ) ;
360+ }
361+
352362 setFocus ( focused : boolean ) {
353363 this . _focused = focused ;
354364 }
You can’t perform that action at this time.
0 commit comments