Skip to content

Commit

Permalink
Don't try creating markup previews of folded cells
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Feb 12, 2022
1 parent 2b752cc commit 6153117
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2540,6 +2540,17 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
return;
}

if (!this.viewModel) {
return;
}

const modelIndex = this.viewModel.getCellIndex(cell);
const foldedRanges = this.viewModel.getHiddenRanges();
const isVisible = !foldedRanges.some(range => modelIndex >= range.start && modelIndex < range.end);
if (!isVisible) {
return;
}

const cellTop = this._list.getAbsoluteTopOfElement(cell);
await this._webview.showMarkupPreview({
mime: cell.mime,
Expand Down

0 comments on commit 6153117

Please sign in to comment.