From 13aec968c2df1537ed148918363fa9035ee3509c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 24 Mar 2021 17:59:51 -0400 Subject: [PATCH] feat: add catch-all method for unhandled notifications --- src/linol.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/linol.ml b/src/linol.ml index 0456e816..d2e386da 100644 --- a/src/linol.ml +++ b/src/linol.ml @@ -80,7 +80,7 @@ module Make(IO : IO) = struct try Some (Hashtbl.find docs uri) with Not_found -> None - (** Overload to process other requests *) + (** Override to process other requests *) method on_request_unhandled : type r. r Lsp.Client_request.t -> r IO.t = fun _r -> @@ -177,6 +177,11 @@ module Make(IO : IO) = struct new_content:string -> unit IO.t + (** Override to handle unprocessed notifications *) + method on_notification_unhandled + ~notify_back:_ (_n:Lsp.Client_notification.t) : unit IO.t = + IO.return () + method on_notification ~notify_back (n:Lsp.Client_notification.t) : unit IO.t = let open Lsp.Types in @@ -229,7 +234,7 @@ module Make(IO : IO) = struct | Lsp.Client_notification.Unknown_notification _ | Lsp.Client_notification.CancelRequest _ -> - IO.return () (* TODO: method for each of these *) + self#on_notification_unhandled ~notify_back n end end end