ILanguageKernel Interface#
Represents a language execution kernel that can run code, provide completions, diagnostics, and hover information. Each kernel targets a single language and manages its own runtime state.
public interface ILanguageKernel : Verso.Abstractions.IExtension, System.IAsyncDisposable
Implements IExtension, System.IAsyncDisposable
Properties#
DisplayName Property#
Human-readable name for the language shown in cell type selectors and status displays.
string DisplayName { get; }
Property Value#
FileExtensions Property#
File extensions associated with this language (e.g. ".cs", ".py"), used for import and export.
System.Collections.Generic.IReadOnlyList<string> FileExtensions { get; }
Property Value#
System.Collections.Generic.IReadOnlyList<System.String>
LanguageId Property#
Language identifier used to associate cells with this kernel (e.g. "csharp", "python").
string LanguageId { get; }
Property Value#
Methods#
ExecuteAsync(string, IExecutionContext) Method#
Executes the supplied code and returns the resulting outputs.
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Verso.Abstractions.CellOutput>> ExecuteAsync(string code, Verso.Abstractions.IExecutionContext context);
Parameters#
code System.String
Source code to execute.
context IExecutionContext
Execution context providing cancellation, display, and variable-sharing APIs.
Returns#
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<CellOutput>>
An ordered list of cell outputs produced by the execution.
GetCompletionsAsync(string, int) Method#
Returns completion suggestions for the given code at the specified cursor position.
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Verso.Abstractions.Completion>> GetCompletionsAsync(string code, int cursorPosition);
Parameters#
code System.String
The full source text of the cell.
cursorPosition System.Int32
Zero-based character offset of the cursor within code.
Returns#
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Completion>>
A list of completion items applicable at the cursor position.
GetDiagnosticsAsync(string) Method#
Analyzes the code and returns any diagnostics (errors, warnings, hints).
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Verso.Abstractions.Diagnostic>> GetDiagnosticsAsync(string code);
Parameters#
code System.String
The full source text to analyze.
Returns#
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Diagnostic>>
A list of diagnostics found in the code.
GetHoverInfoAsync(string, int) Method#
Returns hover information (type details, documentation) for the symbol at the cursor position.
System.Threading.Tasks.Task<Verso.Abstractions.HoverInfo?> GetHoverInfoAsync(string code, int cursorPosition);
Parameters#
code System.String
The full source text of the cell.
cursorPosition System.Int32
Zero-based character offset of the cursor within code.
Returns#
System.Threading.Tasks.Task<HoverInfo>
Hover information for the symbol, or null if nothing is available at that position.
InitializeAsync() Method#
Performs one-time initialization of the kernel runtime. Called once before any execution requests.
System.Threading.Tasks.Task InitializeAsync();
Returns#
System.Threading.Tasks.Task
A task that completes when the kernel is ready to execute code.