From 8857d5e7c59f9e57be924e93a23b9cdb8c23c16a Mon Sep 17 00:00:00 2001 From: Heitor Toledo Lassarote de Paula Date: Wed, 15 Mar 2023 12:02:02 -0300 Subject: [PATCH] Add a comment to send_server_req Problem: There is an invariant that must be satisfied to call that function. Solution: Describe it to warn users of jsonrpc2. --- src/jsonrpc2.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/jsonrpc2.ml b/src/jsonrpc2.ml index b089655e..1b6ae6c2 100644 --- a/src/jsonrpc2.ml +++ b/src/jsonrpc2.ml @@ -86,6 +86,10 @@ module Make (IO : IO) : S with module IO = IO = struct let json = Jsonrpc.Notification.yojson_of_t m in send_json_ self json + (** Send a server request to the LSP client. Invariant: you should call + [register_server_request_response_handler] before calling this method to + ensure that [handle_response] will have a registered handler for this + response. *) let send_server_req (self : t) (m : Jsonrpc.Request.t) : unit IO.t = let json = Jsonrpc.Request.yojson_of_t m in send_json_ self json