diff --git a/ocaml-lsp-server/src/config_data.ml b/ocaml-lsp-server/src/config_data.ml index e6184b726..ab4caba3a 100644 --- a/ocaml-lsp-server/src/config_data.ml +++ b/ocaml-lsp-server/src/config_data.ml @@ -507,17 +507,6 @@ let t_of_yojson = extended_hover_field := Ppx_yojson_conv_lib.Option.Some fvalue | Ppx_yojson_conv_lib.Option.Some _ -> duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) - | "syntaxDocumentation" -> - (match Ppx_yojson_conv_lib.( ! ) syntax_documentation_field with - | Ppx_yojson_conv_lib.Option.None -> - let fvalue = - Json.Nullable_option.t_of_yojson - SyntaxDocumentation.t_of_yojson - _field_yojson - in - syntax_documentation_field := Ppx_yojson_conv_lib.Option.Some fvalue - | Ppx_yojson_conv_lib.Option.Some _ -> - duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) | "inlayHints" -> (match Ppx_yojson_conv_lib.( ! ) inlay_hints_field with | Ppx_yojson_conv_lib.Option.None -> @@ -538,6 +527,17 @@ let t_of_yojson = dune_diagnostics_field := Ppx_yojson_conv_lib.Option.Some fvalue | Ppx_yojson_conv_lib.Option.Some _ -> duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) + | "syntaxDocumentation" -> + (match Ppx_yojson_conv_lib.( ! ) syntax_documentation_field with + | Ppx_yojson_conv_lib.Option.None -> + let fvalue = + Json.Nullable_option.t_of_yojson + SyntaxDocumentation.t_of_yojson + _field_yojson + in + syntax_documentation_field := Ppx_yojson_conv_lib.Option.Some fvalue + | Ppx_yojson_conv_lib.Option.Some _ -> + duplicates := field_name :: Ppx_yojson_conv_lib.( ! ) duplicates) | "merlinJumpCodeActions" -> (match Ppx_yojson_conv_lib.( ! ) merlin_jump_code_actions_field with | Ppx_yojson_conv_lib.Option.None -> @@ -625,35 +625,46 @@ let yojson_of_t = } -> let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in let bnds = - if None = v_dune_diagnostics + if None = v_merlin_jump_code_actions then bnds else ( let arg = - (Json.Nullable_option.yojson_of_t DuneDiagnostics.yojson_of_t) - v_dune_diagnostics + (Json.Nullable_option.yojson_of_t MerlinJumpCodeActions.yojson_of_t) + v_merlin_jump_code_actions in - let bnd = "duneDiagnostics", arg in + let bnd = "merlinJumpCodeActions", arg in bnd :: bnds) in let bnds = - if None = v_inlay_hints + if None = v_syntax_documentation then bnds else ( let arg = - (Json.Nullable_option.yojson_of_t InlayHints.yojson_of_t) v_inlay_hints + (Json.Nullable_option.yojson_of_t SyntaxDocumentation.yojson_of_t) + v_syntax_documentation in - let bnd = "inlayHints", arg in + let bnd = "syntaxDocumentation", arg in bnd :: bnds) in let bnds = - if None = v_syntax_documentation + if None = v_dune_diagnostics then bnds else ( let arg = - (Json.Nullable_option.yojson_of_t SyntaxDocumentation.yojson_of_t) - v_syntax_documentation + (Json.Nullable_option.yojson_of_t DuneDiagnostics.yojson_of_t) + v_dune_diagnostics in - let bnd = "syntaxDocumentation", arg in + let bnd = "duneDiagnostics", arg in + bnd :: bnds) + in + let bnds = + if None = v_inlay_hints + then bnds + else ( + let arg = + (Json.Nullable_option.yojson_of_t InlayHints.yojson_of_t) v_inlay_hints + in + let bnd = "inlayHints", arg in bnd :: bnds) in let bnds = @@ -674,17 +685,6 @@ let yojson_of_t = let bnd = "codelens", arg in bnd :: bnds) in - let bnds = - if None = v_merlin_jump_code_actions - then bnds - else ( - let arg = - (Json.Nullable_option.yojson_of_t MerlinJumpCodeActions.yojson_of_t) - v_merlin_jump_code_actions - in - let bnd = "merlinJumpCodeActions", arg in - bnd :: bnds) - in `Assoc bnds : t -> Ppx_yojson_conv_lib.Yojson.Safe.t) ;; diff --git a/ocaml-lsp-server/src/custom_requests/req_hover_extended.ml b/ocaml-lsp-server/src/custom_requests/req_hover_extended.ml index 665644b14..b6ccd15a2 100644 --- a/ocaml-lsp-server/src/custom_requests/req_hover_extended.ml +++ b/ocaml-lsp-server/src/custom_requests/req_hover_extended.ml @@ -14,10 +14,6 @@ module Request_params = struct } [@@deriving_inline yojson] [@@yojson.allow_extra_fields] - let create ?verbosity ~text_document ~cursor_position () = - { text_document; cursor_position; verbosity } - ;; - let _ = fun (_ : t) -> () let t_of_yojson = @@ -142,6 +138,10 @@ module Request_params = struct [@@@end] + let create ?verbosity ~text_document ~cursor_position () = + { text_document; cursor_position; verbosity } + ;; + let params_schema = `Assoc [ "textDocument", `String ""