Skip to content

Commit

Permalink
fix(lsp): move LogTrace to the correct location (#1107)
Browse files Browse the repository at this point in the history
It's sent by the server to the client rather than the other way around.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg committed May 29, 2023
1 parent 4d4f4cf commit 5ed6103
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
6 changes: 0 additions & 6 deletions lsp/src/client_notification.ml
Expand Up @@ -17,7 +17,6 @@ type t =
| Exit
| CancelRequest of Jsonrpc.Id.t
| WorkDoneProgressCancel of WorkDoneProgressCancelParams.t
| LogTrace of LogTraceParams.t
| SetTrace of SetTraceParams.t
| UnknownNotification of Jsonrpc.Notification.t

Expand All @@ -35,7 +34,6 @@ let method_ = function
| DidCreateFiles _ -> "workspace/didCreateFiles"
| DidDeleteFiles _ -> "workspace/didDeleteFiles"
| DidRenameFiles _ -> "workspace/didRenameFiles"
| LogTrace _ -> "$/logTrace"
| SetTrace _ -> "$/setTrace"
| CancelRequest _ -> Cancel_request.meth_
| WorkDoneProgressCancel _ -> "window/workDoneProgress/cancel"
Expand Down Expand Up @@ -66,7 +64,6 @@ let yojson_of_t = function
| CancelRequest params -> Some (Cancel_request.yojson_of_t params)
| WorkDoneProgressCancel params ->
Some (WorkDoneProgressCancelParams.yojson_of_t params)
| LogTrace params -> Some (LogTraceParams.yojson_of_t params)
| SetTrace params -> Some (SetTraceParams.yojson_of_t params)
| UnknownNotification n -> (n.params :> Json.t option)

Expand Down Expand Up @@ -133,9 +130,6 @@ let of_jsonrpc (r : Jsonrpc.Notification.t) =
Json.message_params params WorkDoneProgressCancelParams.t_of_yojson
in
WorkDoneProgressCancel params
| "$/logTrace" ->
let+ params = Json.message_params params LogTraceParams.t_of_yojson in
LogTrace params
| "$/setTrace" ->
let+ params = Json.message_params params SetTraceParams.t_of_yojson in
SetTrace params
Expand Down
1 change: 0 additions & 1 deletion lsp/src/client_notification.mli
Expand Up @@ -17,7 +17,6 @@ type t =
| Exit
| CancelRequest of Jsonrpc.Id.t
| WorkDoneProgressCancel of WorkDoneProgressCancelParams.t
| LogTrace of LogTraceParams.t
| SetTrace of SetTraceParams.t
| UnknownNotification of Jsonrpc.Notification.t

Expand Down
3 changes: 3 additions & 0 deletions lsp/src/server_notification.ml
Expand Up @@ -26,6 +26,7 @@ type t =
| PublishDiagnostics of PublishDiagnosticsParams.t
| ShowMessage of ShowMessageParams.t
| LogMessage of LogMessageParams.t
| LogTrace of LogTraceParams.t
| TelemetryNotification of Json.t
| CancelRequest of Jsonrpc.Id.t
| WorkDoneProgress of Progress.t ProgressParams.t
Expand All @@ -35,13 +36,15 @@ let method_ = function
| ShowMessage _ -> "window/showMessage"
| PublishDiagnostics _ -> "textDocument/publishDiagnostics"
| LogMessage _ -> "window/logMessage"
| LogTrace _ -> "$/logTrace"
| TelemetryNotification _ -> "telemetry/event"
| CancelRequest _ -> Cancel_request.meth_
| WorkDoneProgress _ -> "$/progress"
| UnknownNotification n -> n.method_

let yojson_of_t = function
| LogMessage params -> Some (LogMessageParams.yojson_of_t params)
| LogTrace params -> Some (LogTraceParams.yojson_of_t params)
| ShowMessage params -> Some (ShowMessageParams.yojson_of_t params)
| PublishDiagnostics params ->
Some (PublishDiagnosticsParams.yojson_of_t params)
Expand Down
1 change: 1 addition & 0 deletions lsp/src/server_notification.mli
Expand Up @@ -12,6 +12,7 @@ type t =
| PublishDiagnostics of PublishDiagnosticsParams.t
| ShowMessage of ShowMessageParams.t
| LogMessage of LogMessageParams.t
| LogTrace of LogTraceParams.t
| TelemetryNotification of Json.t
| CancelRequest of Jsonrpc.Id.t
| WorkDoneProgress of Progress.t ProgressParams.t
Expand Down
1 change: 0 additions & 1 deletion ocaml-lsp-server/src/ocaml_lsp_server.ml
Expand Up @@ -727,7 +727,6 @@ let on_notification server (notification : Client_notification.t) :
| DidCreateFiles _
| DidDeleteFiles _
| DidRenameFiles _
| LogTrace _
| WillSaveTextDocument _
| Initialized
| WorkDoneProgressCancel _
Expand Down

0 comments on commit 5ed6103

Please sign in to comment.