From 1f4337cda266c2aea9441d177fef233a4025dd66 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 13 Dec 2023 13:07:09 -0500 Subject: [PATCH] more tracing --- src/jsonrpc2.ml | 3 ++- src/server.ml | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jsonrpc2.ml b/src/jsonrpc2.ml index 8c8c3fd0..5e904129 100644 --- a/src/jsonrpc2.ml +++ b/src/jsonrpc2.ml @@ -72,7 +72,8 @@ module Make (IO : IO) : S with module IO = IO = struct (* send a single message *) let send_json_ (self : t) (j : json) : unit IO.t = let json = J.to_string j in - Log.debug (fun k -> k "jsonrpc2: send json: %s" json); + Log.debug (fun k -> + k "jsonrpc2: send json (%dB): %s" (String.length json) json); let full_s = Printf.sprintf "Content-Length: %d\r\n\r\n%s" (String.length json) json in diff --git a/src/server.ml b/src/server.ml index bb49c6e2..6851d082 100644 --- a/src/server.ml +++ b/src/server.ml @@ -1,5 +1,6 @@ (** Server interface *) +open Common_ open Sigs type nonrec doc_state = { @@ -323,6 +324,8 @@ module Make (IO : IO) = struct r Lsp.Client_request.t -> r IO.t = fun ~notify_back ~server_request ~id (r : _ Lsp.Client_request.t) -> + Trace.with_span ~__FILE__ ~__LINE__ "linol.on-request" + @@ fun _sp : r IO.t -> Log.debug (fun k -> k "handle request[id=%s] " (Req_id.to_string id)); @@ -521,6 +524,9 @@ module Make (IO : IO) = struct method on_notification ~notify_back ~server_request (n : Lsp.Client_notification.t) : unit IO.t = + let@ _sp = + Trace.with_span ~__FILE__ ~__LINE__ "linol.on-notification" + in let open Lsp.Types in match n with | Lsp.Client_notification.TextDocumentDidOpen