feat: make notebook output display limit configurable via - #325792
feat: make notebook output display limit configurable via #325792pandupan wants to merge 5 commits into
Conversation
Add new setting 'notebook.output.maxItems' (default: 500) to allow users to configure the maximum number of output items rendered per notebook cell. Previously, the output display limit was hard-coded to 500 with no way to increase it. This caused issues for users with cells that produce many outputs (e.g., ML training loops, data processing pipelines, logging). The new setting: - Default: 500 (backward compatible) - Minimum: 1 - Maximum: 10000 - Tagged under 'notebookOutputLayout' Files changed: - notebookCommon.ts: Add setting key to NotebookSetting enum - notebook.contribution.ts: Register setting schema - codeCell.ts: Read limit from configuration service - notebookEditorWidget.ts: Read limit from configuration service - viewportWarmup.ts: Inject IConfigurationService, read limit from config Fixes microsoft#325786 Related: microsoft#228857, microsoft#226261
There was a problem hiding this comment.
Pull request overview
Adds a configurable notebook cell output-rendering limit while preserving the existing default of 500.
Changes:
- Registers
notebook.output.maxItemswith bounds of 1–10,000. - Applies the configured limit to cell rendering and output warmup paths.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
notebookCommon.ts |
Defines the setting key. |
codeCell.ts |
Passes the configured limit to output rendering. |
notebookEditorWidget.ts |
Applies the limit during output warmup. |
notebook.contribution.ts |
Registers the setting schema. |
viewportWarmup.ts |
Applies the limit during viewport warmup. |
| const outputDisplayLimit = this.configurationService.getValue<number>(NotebookSetting.outputDisplayLimit) || defaultOutputDisplayLimit; | ||
| this._outputContainerRenderer = this.instantiationService.createInstance(CellOutputContainer, notebookEditor, viewCell, templateData, { limit: outputDisplayLimit }); |
| }, | ||
| [NotebookSetting.outputDisplayLimit]: { | ||
| markdownDescription: nls.localize('notebook.output.maxItems', "Controls the maximum number of output items to render per notebook cell. When a cell produces more outputs than this limit, a \"show more\" message is displayed. Increase this value if your cell outputs are being truncated."), | ||
| type: 'number', |
|
@microsoft-github-policy-service agree |
Address Copilot review: change type from 'number' to 'integer' since output item count must be a whole number. Fractional values would cause inconsistent behavior between rendering paths.
|
Thanks for the review, Copilot! Comment 1 (integer type): Fixed! Changed Comment 2 (construction-time read): Good observation. I followed the same pattern as the existing |
Description
This PR adds a new setting
notebook.output.maxItemsthat allows users to configure the maximum number of output items rendered per notebook cell.Problem
The notebook output display limit is hard-coded to
500output items. When a cell produces more outputs than this limit, a message appears:This affects many real-world use cases:
print()andloggingAdditionally, the "show more" link often fails with an error (#226261), leaving users with no way to view their truncated output.
Solution
Add a new configurable setting:
number500(backward compatible)110000notebookOutputLayoutImplementation
The hard-coded
outputDisplayLimit = 500constant is preserved as a fallback default. Each usage site now reads from the configuration service first:Files Changed
notebookCommon.tsoutputDisplayLimitkey toNotebookSettingenumnotebook.contribution.tscodeCell.tsIConfigurationServicenotebookEditorWidget.tsIConfigurationServiceviewportWarmup.tsIConfigurationService, read limit from configTesting
"notebook.output.maxItems": 1000to settingsRelated Issues
Note: The
npm installstep timed out during local testing due to the large repo size. The CI pipeline will handle the full build verification. The changes follow the exact same patterns used by other notebook output settings (e.g.,notebook.output.textLineLimit,notebook.output.scrolling).