diff --git a/ocaml-lsp-server/src/ocamlformat_rpc.ml b/ocaml-lsp-server/src/ocamlformat_rpc.ml index e03ada315..4c972dd42 100644 --- a/ocaml-lsp-server/src/ocamlformat_rpc.ml +++ b/ocaml-lsp-server/src/ocamlformat_rpc.ml @@ -41,22 +41,19 @@ let configure process = editors that use the server. *) match Scheduler.async io_thread (fun () -> - match - Ocamlformat_rpc_lib.config - [ ("module-item-spacing", "compact"); ("margin", "64") ] - client - with - | Ok () -> () - | Error (`Msg msg) -> - Log.log ~section:"ocamlformat" (fun () -> - Log.msg "An error occured while configuring ocamlformat" - [ ("msg", `String msg) ])) + Ocamlformat_rpc_lib.config + [ ("module-item-spacing", "compact"); ("margin", "64") ] + client) with | Error `Stopped -> Fiber.return () | Ok res -> ( let+ res = Scheduler.await_no_cancel res in match res with - | Ok s -> s + | Ok (Ok ()) -> () + | Ok (Error (`Msg msg)) -> + Log.log ~section:"ocamlformat" (fun () -> + Log.msg "An error occured while configuring ocamlformat" + [ ("msg", `String msg) ]) | Error e -> Exn_with_backtrace.reraise e) let start_exn ?io_thread t =