Skip to content

Commit addb079

Browse files
authored
Use the output limit for the warmup calls (microsoft#184624)
* re-use the output limit where applicable * put limit in the viewmodel
1 parent 0e06e43 commit addb079

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
88
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
99
import { CellEditState, IInsetRenderOutput, INotebookEditor, INotebookEditorContribution, INotebookEditorDelegate, RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
1010
import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
11-
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
11+
import { CodeCellViewModel, outputDisplayLimit } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
1212
import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1313
import { cellRangesToIndexes } from 'vs/workbench/contrib/notebook/common/notebookRange';
1414
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
@@ -86,7 +86,7 @@ class NotebookViewportContribution extends Disposable implements INotebookEditor
8686
}
8787

8888
const outputs = viewCell.outputsViewModels;
89-
for (const output of outputs) {
89+
for (const output of outputs.slice(0, outputDisplayLimit)) {
9090
const [mimeTypes, pick] = output.resolveMimeTypes(this._notebookEditor.textModel!, undefined);
9191
if (!mimeTypes.find(mimeType => mimeType.isTrusted) || mimeTypes.length === 0) {
9292
continue;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ import { INotebookCellList } from 'vs/workbench/contrib/notebook/browser/view/no
6060
import { BackLayerWebView } from 'vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView';
6161
import { CodeCellRenderer, MarkupCellRenderer, NotebookCellListDelegate } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer';
6262
import { IAckOutputHeight, IMarkupCellInitialization } from 'vs/workbench/contrib/notebook/browser/view/renderers/webviewMessages';
63-
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
63+
import { CodeCellViewModel, outputDisplayLimit } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
6464
import { NotebookEventDispatcher } from 'vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher';
6565
import { MarkupCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel';
6666
import { CellViewModel, NotebookViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl';
@@ -2395,7 +2395,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
23952395
}
23962396

23972397
const outputs = viewCell.outputsViewModels;
2398-
for (const output of outputs) {
2398+
for (const output of outputs.slice(0, outputDisplayLimit)) {
23992399
const [mimeTypes, pick] = output.resolveMimeTypes(this.textModel!, undefined);
24002400
if (!mimeTypes.find(mimeType => mimeType.isTrusted) || mimeTypes.length === 0) {
24012401
continue;

src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { CellEditorOptions } from 'vs/workbench/contrib/notebook/browser/view/ce
2727
import { CellOutputContainer } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput';
2828
import { CollapsedCodeCellExecutionIcon } from 'vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon';
2929
import { CodeCellRenderTemplate } from 'vs/workbench/contrib/notebook/browser/view/notebookRenderingCommon';
30-
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
30+
import { CodeCellViewModel, outputDisplayLimit } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
3131
import { INotebookExecutionStateService } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService';
3232
import { WordHighlighterContribution } from 'vs/editor/contrib/wordHighlighter/browser/wordHighlighter';
3333

@@ -56,7 +56,7 @@ export class CodeCell extends Disposable {
5656
super();
5757

5858
const cellEditorOptions = this._register(new CellEditorOptions(this.notebookEditor.getBaseCellEditorOptions(viewCell.language), this.notebookEditor.notebookOptions, this.configurationService));
59-
this._outputContainerRenderer = this.instantiationService.createInstance(CellOutputContainer, notebookEditor, viewCell, templateData, { limit: 500 });
59+
this._outputContainerRenderer = this.instantiationService.createInstance(CellOutputContainer, notebookEditor, viewCell, templateData, { limit: outputDisplayLimit });
6060
this.cellParts = this._register(templateData.cellParts.concatContentPart([cellEditorOptions, this._outputContainerRenderer]));
6161

6262
// this.viewCell.layoutInfo.editorHeight or estimation when this.viewCell.layoutInfo.editorHeight === 0

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { BaseCellViewModel } from './baseCellViewModel';
2323
import { NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookViewEvents';
2424
import { ICellExecutionStateChangedEvent } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService';
2525

26+
export const outputDisplayLimit = 500;
27+
2628
export class CodeCellViewModel extends BaseCellViewModel implements ICellViewModel {
2729
readonly cellKind = CellKind.Code;
2830

0 commit comments

Comments
 (0)