VersoContext Class#
Base IVersoContext implementation. Output routing is provided via an injected delegate.
public class VersoContext : Verso.Abstractions.IVersoContext
Inheritance System.Object → VersoContext
Derived
↳ ExecutionContext
↳ MagicCommandContext
Implements IVersoContext
Constructors#
VersoContext(IVariableStore, CancellationToken, IThemeContext, LayoutCapabilities, IExtensionHostContext, INotebookMetadata, INotebookOperations, Func<CellOutput,Task>) Constructor#
Builds a context with no in-place output updating, which is what a host that cannot revise an output provides.
public VersoContext(Verso.Abstractions.IVariableStore variables, System.Threading.CancellationToken cancellationToken, Verso.Abstractions.IThemeContext theme, Verso.Abstractions.LayoutCapabilities layoutCapabilities, Verso.Abstractions.IExtensionHostContext extensionHost, Verso.Abstractions.INotebookMetadata notebookMetadata, Verso.Abstractions.INotebookOperations notebook, System.Func<Verso.Abstractions.CellOutput,System.Threading.Tasks.Task> writeOutput);
Parameters#
variables IVariableStore
cancellationToken System.Threading.CancellationToken
theme IThemeContext
layoutCapabilities LayoutCapabilities
extensionHost IExtensionHostContext
notebookMetadata INotebookMetadata
notebook INotebookOperations
writeOutput System.Func<CellOutput,System.Threading.Tasks.Task>
Remarks#
Kept as its own overload rather than folded into the one below. An optional parameter is resolved where the call is compiled, so adding one to a shipped constructor changes the signature every existing compiled caller looks for.
Properties#
CancellationToken Property#
Gets the cancellation token that signals when the current operation should be aborted.
public System.Threading.CancellationToken CancellationToken { get; }
Implements CancellationToken
Property Value#
System.Threading.CancellationToken
ExtensionHost Property#
Gets the extension host context for querying loaded extensions by category.
public Verso.Abstractions.IExtensionHostContext ExtensionHost { get; }
Implements ExtensionHost
Property Value#
LayoutCapabilities Property#
Gets the layout capabilities supported by the current rendering surface.
public Verso.Abstractions.LayoutCapabilities LayoutCapabilities { get; }
Implements LayoutCapabilities
Property Value#
Notebook Property#
Gets the notebook operations interface for executing cells, managing outputs, and mutating the cell collection.
public Verso.Abstractions.INotebookOperations Notebook { get; }
Implements Notebook
Property Value#
NotebookMetadata Property#
Gets the read-only metadata for the current notebook.
public Verso.Abstractions.INotebookMetadata NotebookMetadata { get; }
Implements NotebookMetadata
Property Value#
OutputChannels Property#
Gets the session's output channels, or null when this host cannot reach a rendered
view. A channel keeps one output in conversation with what draws it for as long as the
session lives, rather than for the length of a cell.
public Verso.Abstractions.IOutputChannelHost? OutputChannels { get; init; }
Implements OutputChannels
Property Value#
Remarks#
The null default is the capability signal, matching LayoutCapabilities and RequestFileDownloadAsync(string, string, byte[]). A host that renders to a file, a terminal, or anything else with nothing to talk back leaves it null, and a caller that finds it null writes ordinary static output instead of failing.
Theme Property#
Gets the active theme context for resolving colors, fonts, and spacing.
public Verso.Abstractions.IThemeContext Theme { get; }
Implements Theme
Property Value#
Variables Property#
Gets the shared variable store for exchanging data between kernels.
public Verso.Abstractions.IVariableStore Variables { get; }
Implements Variables
Property Value#
Methods#
UpdateOutputAsync(string, CellOutput) Method#
Updates an existing output block in place, replacing its content with the new output.
public System.Threading.Tasks.Task UpdateOutputAsync(string outputBlockId, Verso.Abstractions.CellOutput output);
Parameters#
outputBlockId System.String
The identifier of the output block to update.
output CellOutput
The new cell output to display.
Implements UpdateOutputAsync(string, CellOutput)
Returns#
System.Threading.Tasks.Task
A task that completes when the update has been sent.
WriteOutputAsync(CellOutput) Method#
Writes a cell output to the notebook output stream.
public System.Threading.Tasks.Task WriteOutputAsync(Verso.Abstractions.CellOutput output);
Parameters#
output CellOutput
The cell output to write.
Implements WriteOutputAsync(CellOutput)
Returns#
System.Threading.Tasks.Task
A task that completes when the output has been written.