Skip to content

Commit 408ad5d

Browse files
committed
1 parent 3e0bdab commit 408ad5d

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
});

src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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;

src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)