more tracing

This commit is contained in:
Simon Cruanes 2023-12-13 13:07:09 -05:00
parent fa2900d8e5
commit 1f4337cda2
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -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] <opaque>" (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