Repository navigation
Pass the cell and output channels through to formatters - #122
Merged
TorreyBetts merged 1 commit intoOct 7, 2026
Merged
TorreyBetts merged 1 commit into
TorreyBetts merged 1 commit into
Conversation
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]>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.