Module Cobol_lsp.IO

Simple communication functions for the LSP server to send an receive json RPC messages.

exception Parse_error of string
val initialize_channels : unit -> unit

initialize_channels () sets stdin and stdout channels in binary mode; this is required for proper operations on some systems.

val read_message : unit -> Jsonrpc.Packet.t

read_message () tries to read a json RPC message from the standard input stream. Raises End_of_file upon end of input stream.

val send_response : Jsonrpc.Response.t -> unit

send_response response sends out a json RPC response on standard output.

val send_request : Jsonrpc.Request.t -> unit

send_request required sends out a json RPC request on standard output.

val send_notification : Jsonrpc.Notification.t -> unit

send_notification notif sends out a json RPC notification on standard output.

val send_diagnostics : uri:Lsp.Uri.t -> Lsp.Types.Diagnostic.t list -> unit

send_diagnostics ~uri diagnostics sends out a list of diagnostics that pertain to the given URI.

val pretty_message : ?log:bool -> type_:Lsp.Types.MessageType.t -> ('a, Stdlib.Format.formatter, unit) Stdlib.format -> 'a

pretty_message ~log ~type_ fmt ... formats any number of arguments according to the format string fmt, and sends the result via a json RPC notification.

val pretty_log : type_:Lsp.Types.MessageType.t -> _ Pretty.proc

pretty_log ~type_ fmt ... formats any number of arguments according to the format string fmt, and sends the result as a log message via a json RPC notification.

val log : type_:Lsp.Types.MessageType.t -> _ Pretty.proc
val log_error : _ Pretty.proc
val log_warn : _ Pretty.proc
val log_info : _ Pretty.proc
val log_debug : _ Pretty.proc
val pretty_notification : type_:Lsp.Types.MessageType.t -> _ Pretty.proc

pretty_notification ~type_ fmt ... formats any number of arguments according to the format string fmt, and sends the result as a user notification message via a json RPC notification.

val notification : type_:Lsp.Types.MessageType.t -> _ Pretty.proc
val notify_error : _ Pretty.proc
val notify_warn : _ Pretty.proc
val notify_info : _ Pretty.proc