diff --git a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts index b757148cc8d2d..ff0bbd819640f 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts @@ -775,6 +775,7 @@ export interface CodeCellRenderTemplate extends BaseCellRenderTemplate { focusSinkElement: HTMLElement; editor: ICodeEditor; progressBar: ProgressBar; + collapsedProgressBar: ProgressBar; focusIndicatorRight: HTMLElement; focusIndicatorBottom: HTMLElement; dragHandle: HTMLElement; diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts index 85eb84794fbed..ba77cce9fe95b 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts @@ -647,6 +647,10 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende progressBar.hide(); disposables.add(progressBar); + const collapsedProgressBar = new ProgressBar(cellInputCollapsedContainer); + collapsedProgressBar.hide(); + disposables.add(collapsedProgressBar); + const statusBar = disposables.add(this.instantiationService.createInstance(CellEditorStatusBar, editorPart)); const outputContainer = DOM.append(container, $('.output')); @@ -673,6 +677,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende decorationContainer, cellContainer, progressBar, + collapsedProgressBar, statusBar, focusIndicatorLeft: focusIndicator, focusIndicatorRight, @@ -887,10 +892,18 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende const internalMetadata = element.internalMetadata; this.updateExecutionOrder(internalMetadata, templateData); + if (element.metadata.inputCollapsed) { + templateData.progressBar.hide(); + } else { + templateData.collapsedProgressBar.hide(); + } + + const progressBar = element.metadata.inputCollapsed ? templateData.collapsedProgressBar : templateData.progressBar; + if (internalMetadata.runState === NotebookCellExecutionState.Executing && !internalMetadata.isPaused) { - templateData.progressBar.infinite().show(500); + progressBar.infinite().show(500); } else { - templateData.progressBar.hide(); + progressBar.hide(); } } @@ -999,7 +1012,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende this.updateForFocus(element, templateData); cellEditorOptions.setLineNumbers(element.lineNumbers); elementDisposables.add(element.onDidChangeState((e) => { - if (e.internalMetadataChanged) { + if (e.metadataChanged || e.internalMetadataChanged) { this.updateForInternalMetadata(element, templateData); this.updateForLayout(element, templateData); } diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts index dac77c015b25d..750038b8b259a 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts @@ -300,7 +300,17 @@ export class CodeCell extends Disposable { } private _removeInputCollapsePreview() { - DOM.clearNode(this.templateData.cellInputCollapsedContainer); + const children = this.templateData.cellInputCollapsedContainer.children; + const elements = []; + for (let i = 0; i < children.length; i++) { + if (children[i].classList.contains('cell-collapse-preview')) { + elements.push(children[i]); + } + } + + elements.forEach(element => { + element.parentElement?.removeChild(element); + }); } private _updateOutputInnertContainer(hide: boolean) {