Docs · API reference · Verso.Abstractions

IVersoContext Interface#

Base context provided to all Verso extension operations, exposing shared services and capabilities.

public interface IVersoContext

Derived
↳ ICellRenderContext
↳ IExecutionContext
↳ IFormatterContext
↳ IMagicCommandContext
↳ IPanelContext
↳ IToolbarActionContext

Properties#

ActiveLayoutId Property#

Gets the identifier of the currently active layout engine, or null if none is active.

string? ActiveLayoutId { get; }

Property Value#

System.String

CancellationToken Property#

Gets the cancellation token that signals when the current operation should be aborted.

System.Threading.CancellationToken CancellationToken { get; }

Property Value#

System.Threading.CancellationToken

CollapsedSections Property#

Gets the identifiers of the heading cells whose sections are currently collapsed. A layout can use this to fold (omit) the cells that fall under a collapsed heading, mirroring the built-in cell list. Empty when the host does not track section collapse state.

System.Collections.Generic.IReadOnlySet<System.Guid> CollapsedSections { get; }

Property Value#

System.Collections.Generic.IReadOnlySet<System.Guid>

ExtensionHost Property#

Gets the extension host context for querying loaded extensions by category.

Verso.Abstractions.IExtensionHostContext ExtensionHost { get; }

Property Value#

IExtensionHostContext

LayoutCapabilities Property#

Gets the layout capabilities supported by the current rendering surface.

Verso.Abstractions.LayoutCapabilities LayoutCapabilities { get; }

Property Value#

LayoutCapabilities

Notebook Property#

Gets the notebook operations interface for executing cells, managing outputs, and mutating the cell collection.

Verso.Abstractions.INotebookOperations Notebook { get; }

Property Value#

INotebookOperations

NotebookMetadata Property#

Gets the read-only metadata for the current notebook.

Verso.Abstractions.INotebookMetadata NotebookMetadata { get; }

Property Value#

INotebookMetadata

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.

Verso.Abstractions.IOutputChannelHost? OutputChannels { get; }

Property Value#

IOutputChannelHost

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.

Verso.Abstractions.IThemeContext Theme { get; }

Property Value#

IThemeContext

UICulture Property#

Gets the language the host asked this operation to answer in.

System.Globalization.CultureInfo UICulture { get; }

Property Value#

System.Globalization.CultureInfo

Remarks#

Every host also sets this as the thread's current UI culture, so a generated resource class follows it without being told. Read it here when something takes a culture explicitly, such as building a table of strings for a renderer that cannot reach a resource manager itself. It is fixed for the life of the session: a user who changes the interface language reopens the notebook to see it.

Variables Property#

Gets the shared variable store for exchanging data between kernels.

Verso.Abstractions.IVariableStore Variables { get; }

Property Value#

IVariableStore

Methods#

RequestFileDownloadAsync(string, string, byte[]) Method#

Requests that the host deliver a file download to the user.

System.Threading.Tasks.Task RequestFileDownloadAsync(string fileName, string contentType, byte[] data);

Parameters#

fileName System.String

The suggested file name for the download.

contentType System.String

The MIME content type of the file.

data System.Byte[]

The file contents as a byte array.

Returns#

System.Threading.Tasks.Task
A task that completes when the download has been initiated.

UpdateOutputAsync(string, CellOutput) Method#

Updates an existing output block in place, replacing its content with the new output.

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.

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.

System.Threading.Tasks.Task WriteOutputAsync(Verso.Abstractions.CellOutput output);

Parameters#

output CellOutput

The cell output to write.

Returns#

System.Threading.Tasks.Task
A task that completes when the output has been written.