ProtocolDefines the core data structures used for communication between the C++/JavaScript frontend and the OCaml backend of the kernel.
These types are automatically serialized to and from JSON using `ppx_deriving_yojson`, forming a strict contract between the two parts of the application. This module is the single source of truth for the API.
val source_to_yojson : source -> Yojson.Safe.tval source_of_yojson :
Yojson.Safe.t ->
source Ppx_deriving_yojson_runtime.error_orRepresents a cursor position within a source code buffer.
`Offset i indicates the position is at the i-th byte from the start.val position_to_yojson : position -> Yojson.Safe.tval position_of_yojson :
Yojson.Safe.t ->
position Ppx_deriving_yojson_runtime.error_orval to_msource_position : position -> Merlin_kernel.Msource.positionConverts a position from this protocol into Merlin's internal Msource.position type, which is required for all Merlin queries.
type dynamic_setup_config = {dsc_url : string;The base URL from which to fetch dynamic standard library files and other assets.
*)}Configuration data required for the initial kernel setup.
val dynamic_setup_config_to_yojson : dynamic_setup_config -> Yojson.Safe.tval dynamic_setup_config_of_yojson :
Yojson.Safe.t ->
dynamic_setup_config Ppx_deriving_yojson_runtime.error_ortype action = | Complete_prefix of {}A request for code completion at a given position.
*)| Type_enclosing of {}A request for the type of the expression enclosing a given position.
*)| Document of {}A request for the documentation (docstring) of the identifier at a given position.
*)| Eval of {source : source;}A request to evaluate a block of source code.
*)| All_errors of {source : source;}A request to get all syntax and type errors in a source buffer.
*)| Setup of dynamic_setup_configThe initial command to set up the kernel environment.
*)| List_files of {}A utility command to list files in the virtual filesystem (for debugging).
*)The main variant type that represents all possible commands the frontend can send to the OCaml backend.
val action_to_yojson : action -> Yojson.Safe.tval action_of_yojson :
Yojson.Safe.t ->
action Ppx_deriving_yojson_runtime.error_ortype error = {kind : Location.report_kind;The category of the report (e.g., error, warning).
*)loc : Location.t;The source code location of the error.
*)main : string;The primary error message.
*)sub : string list;A list of secondary or supplementary messages.
*)source : Location.error_source;The stage of the toolchain that produced the error (lexer, parser, typer).
*)}Represents a single structured error or warning from the OCaml toolchain.
type output = | Stdout of stringContent captured from the standard output channel.
*)| Stderr of stringContent captured from the standard error channel.
*)| Value of stringThe formatted string representation of a toplevel expression's result (e.g., `- : int = 2`).
| DisplayData of Yojson.Safe.tA rich output represented as a JSON MIME bundle, for rendering HTML, images, etc.
*)Represents all possible kinds of output that can result from a code evaluation. These are collected and sent back to the frontend for rendering.
val output_to_yojson : output -> Yojson.Safe.tval output_of_yojson :
Yojson.Safe.t ->
output Ppx_deriving_yojson_runtime.error_orval _ : Yojson.Safe.t -> output Ppx_deriving_yojson_runtime.error_ortype completions = {from : int;The starting position (byte offset) of the text to be replaced.
*)to_ : int;The ending position (byte offset) of the text to be replaced.
*)entries : Query_protocol.Compl.entry list;The list of completion entries provided by Merlin.
*)}A record representing a list of completion candidates from Merlin.
A type used by Merlin to indicate if a position is in a tail-call context.