Skip to content

Pass the cell and output channels through to formatters - #122

Merged
TorreyBetts merged 1 commit into
DataficationSDK:mainfrom
Jonathan-Schaefer-git:fsharp-formatter-output-channels
Oct 7, 2026
Merged

TorreyBetts merged 1 commit into
DataficationSDK:mainfrom
Jonathan-Schaefer-git:fsharp-formatter-output-channels

Conversation

@Jonathan-Schaefer-git

Copy link
Copy Markdown
Contributor

I am building a plotting library and the Verso extension had no way to show interactive figures. To update a figure after cell finishes rendering, the formatter opens an output channel for the cell. This needs the cell id, which IFormatterContext didn't have, and OutputChannels, which the C# and F# kernels' formatter contexts didn't forward.

Inside a kernel it was always null, like the other optional members (UICulture, UpdateOutputAsync, etc.).

IFormatterContext now has a CellId, and the kernel, display and hinted formatter contexts forward every optional member of the execution context. CellId defaults to null, so existing implementations are unaffected. It is also null outside a cell (e.g. the variable explorer), defaulting to a formatter writing static output.

Tests cover the forwarding for both wrappers and check that both kernels give a formatter the cell id and the output channels.

IFormatterContext gains a CellId (default null, backward compatible).
The formatter contexts in the C# and F# kernels and DisplayFormatterContext/HintedFormatterContext now
forward CellId, OutputChannels, ActiveLayoutId, CollapsedSections,
UICulture, UpdateOutputAsync and RequestFileDownloadAsync from the
execution context instead of falling back to just the interface defaults.
With CellId and OutputChannels a formatter can open a channel for its output.

Signed-off-by: Jonathan Schäfer <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 12:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@TorreyBetts
TorreyBetts merged commit 7ca832c into DataficationSDK:main Oct 7, 2026
11 checks passed
@TorreyBetts

Copy link
Copy Markdown
Contributor

Thanks for taking the time to fix this gap, it's merged and will be in the next release. Good luck with the plotting library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants