11open Import
22open Import.Json.Conv
33
4+ module ShortenMerlinDiagnostics = struct
5+ type t = { enable : bool [@ default false ] }
6+ [@@ deriving_inline yojson ] [@@ yojson.allow_extra_fields]
7+
8+ let _ = fun (_ : t ) -> ()
9+
10+ let t_of_yojson =
11+ (let _tp_loc = " ocaml-lsp-server/src/config_data.ml.ShortenMerlinDiagnostics.t" in
12+ function
13+ | `Assoc field_yojsons as yojson ->
14+ let enable_field = ref Ppx_yojson_conv_lib.Option. None
15+ and duplicates = ref []
16+ and extra = ref [] in
17+ let rec iter = function
18+ | (field_name , _field_yojson ) :: tail ->
19+ (match field_name with
20+ | "enable" ->
21+ (match Ppx_yojson_conv_lib. ( ! ) enable_field with
22+ | Ppx_yojson_conv_lib.Option. None ->
23+ let fvalue = bool_of_yojson _field_yojson in
24+ enable_field := Ppx_yojson_conv_lib.Option. Some fvalue
25+ | Ppx_yojson_conv_lib.Option. Some _ ->
26+ duplicates := field_name :: Ppx_yojson_conv_lib. ( ! ) duplicates)
27+ | _ -> () );
28+ iter tail
29+ | [] -> ()
30+ in
31+ iter field_yojsons;
32+ (match Ppx_yojson_conv_lib. ( ! ) duplicates with
33+ | _ :: _ ->
34+ Ppx_yojson_conv_lib.Yojson_conv_error. record_duplicate_fields
35+ _tp_loc
36+ (Ppx_yojson_conv_lib. ( ! ) duplicates)
37+ yojson
38+ | [] ->
39+ (match Ppx_yojson_conv_lib. ( ! ) extra with
40+ | _ :: _ ->
41+ Ppx_yojson_conv_lib.Yojson_conv_error. record_extra_fields
42+ _tp_loc
43+ (Ppx_yojson_conv_lib. ( ! ) extra)
44+ yojson
45+ | [] ->
46+ let enable_value = Ppx_yojson_conv_lib. ( ! ) enable_field in
47+ { enable =
48+ (match enable_value with
49+ | Ppx_yojson_conv_lib.Option. None -> false
50+ | Ppx_yojson_conv_lib.Option. Some v -> v)
51+ }))
52+ | _ as yojson ->
53+ Ppx_yojson_conv_lib.Yojson_conv_error. record_list_instead_atom _tp_loc yojson
54+ : Ppx_yojson_conv_lib.Yojson.Safe. t -> t)
55+ ;;
56+
57+ let _ = t_of_yojson
58+
59+ let yojson_of_t =
60+ (function
61+ | { enable = v_enable } ->
62+ let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in
63+ let bnds =
64+ let arg = yojson_of_bool v_enable in
65+ (" enable" , arg) :: bnds
66+ in
67+ `Assoc bnds
68+ : t -> Ppx_yojson_conv_lib.Yojson.Safe. t)
69+ ;;
70+
71+ let _ = yojson_of_t
72+
73+ [@@@ end]
74+ end
75+
476module InlayHints = struct
577 type t =
678 { hint_pattern_variables : bool [@ key "hintPatternVariables" ] [@ default false ]
@@ -565,6 +637,8 @@ type t =
565637 [@ key "syntaxDocumentation" ] [@ default None ] [@ yojson_drop_default ( = )]
566638 ; merlin_jump_code_actions : MerlinJumpCodeActions .t Json.Nullable_option .t
567639 [@ key "merlinJumpCodeActions" ] [@ default None ] [@ yojson_drop_default ( = )]
640+ ; shorten_merlin_diagnostics : ShortenMerlinDiagnostics .t Json.Nullable_option .t
641+ [@ key "shortenMerlinDiagnostics" ] [@ default None ] [@ yojson_drop_default ( = )]
568642 }
569643[@@ deriving_inline yojson ] [@@ yojson.allow_extra_fields]
570644
@@ -581,6 +655,7 @@ let t_of_yojson =
581655 and dune_diagnostics_field = ref Ppx_yojson_conv_lib.Option. None
582656 and syntax_documentation_field = ref Ppx_yojson_conv_lib.Option. None
583657 and merlin_jump_code_actions_field = ref Ppx_yojson_conv_lib.Option. None
658+ and shorten_merlin_diagnostics_field = ref Ppx_yojson_conv_lib.Option. None
584659 and duplicates = ref []
585660 and extra = ref [] in
586661 let rec iter = function
@@ -655,6 +730,17 @@ let t_of_yojson =
655730 merlin_jump_code_actions_field := Ppx_yojson_conv_lib.Option. Some fvalue
656731 | Ppx_yojson_conv_lib.Option. Some _ ->
657732 duplicates := field_name :: Ppx_yojson_conv_lib. ( ! ) duplicates)
733+ | "shortenMerlinDiagnostics" ->
734+ (match Ppx_yojson_conv_lib. ( ! ) shorten_merlin_diagnostics_field with
735+ | Ppx_yojson_conv_lib.Option. None ->
736+ let fvalue =
737+ Json.Nullable_option. t_of_yojson
738+ ShortenMerlinDiagnostics. t_of_yojson
739+ _field_yojson
740+ in
741+ shorten_merlin_diagnostics_field := Ppx_yojson_conv_lib.Option. Some fvalue
742+ | Ppx_yojson_conv_lib.Option. Some _ ->
743+ duplicates := field_name :: Ppx_yojson_conv_lib. ( ! ) duplicates)
658744 | _ -> () );
659745 iter tail
660746 | [] -> ()
@@ -680,15 +766,17 @@ let t_of_yojson =
680766 , inlay_hints_value
681767 , dune_diagnostics_value
682768 , syntax_documentation_value
683- , merlin_jump_code_actions_value )
769+ , merlin_jump_code_actions_value
770+ , shorten_merlin_diagnostics_value )
684771 =
685772 ( Ppx_yojson_conv_lib. ( ! ) codelens_field
686773 , Ppx_yojson_conv_lib. ( ! ) extended_hover_field
687774 , Ppx_yojson_conv_lib. ( ! ) standard_hover_field
688775 , Ppx_yojson_conv_lib. ( ! ) inlay_hints_field
689776 , Ppx_yojson_conv_lib. ( ! ) dune_diagnostics_field
690777 , Ppx_yojson_conv_lib. ( ! ) syntax_documentation_field
691- , Ppx_yojson_conv_lib. ( ! ) merlin_jump_code_actions_field )
778+ , Ppx_yojson_conv_lib. ( ! ) merlin_jump_code_actions_field
779+ , Ppx_yojson_conv_lib. ( ! ) shorten_merlin_diagnostics_field )
692780 in
693781 { codelens =
694782 (match codelens_value with
@@ -718,6 +806,10 @@ let t_of_yojson =
718806 (match merlin_jump_code_actions_value with
719807 | Ppx_yojson_conv_lib.Option. None -> None
720808 | Ppx_yojson_conv_lib.Option. Some v -> v)
809+ ; shorten_merlin_diagnostics =
810+ (match shorten_merlin_diagnostics_value with
811+ | Ppx_yojson_conv_lib.Option. None -> None
812+ | Ppx_yojson_conv_lib.Option. Some v -> v)
721813 }))
722814 | _ as yojson ->
723815 Ppx_yojson_conv_lib.Yojson_conv_error. record_list_instead_atom _tp_loc yojson
@@ -735,8 +827,20 @@ let yojson_of_t =
735827 ; dune_diagnostics = v_dune_diagnostics
736828 ; syntax_documentation = v_syntax_documentation
737829 ; merlin_jump_code_actions = v_merlin_jump_code_actions
830+ ; shorten_merlin_diagnostics = v_shorten_merlin_diagnostics
738831 } ->
739832 let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in
833+ let bnds =
834+ if None = v_shorten_merlin_diagnostics
835+ then bnds
836+ else (
837+ let arg =
838+ (Json.Nullable_option. yojson_of_t ShortenMerlinDiagnostics. yojson_of_t)
839+ v_shorten_merlin_diagnostics
840+ in
841+ let bnd = " shortenMerlinDiagnostics" , arg in
842+ bnd :: bnds)
843+ in
740844 let bnds =
741845 if None = v_merlin_jump_code_actions
742846 then bnds
@@ -829,5 +933,6 @@ let default =
829933 ; dune_diagnostics = Some { enable = true }
830934 ; syntax_documentation = Some { enable = false }
831935 ; merlin_jump_code_actions = Some { enable = false }
936+ ; shorten_merlin_diagnostics = Some { enable = false }
832937 }
833938;;
0 commit comments