1
1
open Import
2
2
open Import.Json.Conv
3
3
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
+
4
76
module InlayHints = struct
5
77
type t =
6
78
{ hint_pattern_variables : bool [@ key "hintPatternVariables" ] [@ default false ]
@@ -565,6 +637,8 @@ type t =
565
637
[@ key "syntaxDocumentation" ] [@ default None ] [@ yojson_drop_default ( = )]
566
638
; merlin_jump_code_actions : MerlinJumpCodeActions .t Json.Nullable_option .t
567
639
[@ 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 ( = )]
568
642
}
569
643
[@@ deriving_inline yojson ] [@@ yojson.allow_extra_fields]
570
644
@@ -581,6 +655,7 @@ let t_of_yojson =
581
655
and dune_diagnostics_field = ref Ppx_yojson_conv_lib.Option. None
582
656
and syntax_documentation_field = ref Ppx_yojson_conv_lib.Option. None
583
657
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
584
659
and duplicates = ref []
585
660
and extra = ref [] in
586
661
let rec iter = function
@@ -655,6 +730,17 @@ let t_of_yojson =
655
730
merlin_jump_code_actions_field := Ppx_yojson_conv_lib.Option. Some fvalue
656
731
| Ppx_yojson_conv_lib.Option. Some _ ->
657
732
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)
658
744
| _ -> () );
659
745
iter tail
660
746
| [] -> ()
@@ -680,15 +766,17 @@ let t_of_yojson =
680
766
, inlay_hints_value
681
767
, dune_diagnostics_value
682
768
, syntax_documentation_value
683
- , merlin_jump_code_actions_value )
769
+ , merlin_jump_code_actions_value
770
+ , shorten_merlin_diagnostics_value )
684
771
=
685
772
( Ppx_yojson_conv_lib. ( ! ) codelens_field
686
773
, Ppx_yojson_conv_lib. ( ! ) extended_hover_field
687
774
, Ppx_yojson_conv_lib. ( ! ) standard_hover_field
688
775
, Ppx_yojson_conv_lib. ( ! ) inlay_hints_field
689
776
, Ppx_yojson_conv_lib. ( ! ) dune_diagnostics_field
690
777
, 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 )
692
780
in
693
781
{ codelens =
694
782
(match codelens_value with
@@ -718,6 +806,10 @@ let t_of_yojson =
718
806
(match merlin_jump_code_actions_value with
719
807
| Ppx_yojson_conv_lib.Option. None -> None
720
808
| 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)
721
813
}))
722
814
| _ as yojson ->
723
815
Ppx_yojson_conv_lib.Yojson_conv_error. record_list_instead_atom _tp_loc yojson
@@ -735,8 +827,20 @@ let yojson_of_t =
735
827
; dune_diagnostics = v_dune_diagnostics
736
828
; syntax_documentation = v_syntax_documentation
737
829
; merlin_jump_code_actions = v_merlin_jump_code_actions
830
+ ; shorten_merlin_diagnostics = v_shorten_merlin_diagnostics
738
831
} ->
739
832
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
740
844
let bnds =
741
845
if None = v_merlin_jump_code_actions
742
846
then bnds
@@ -829,5 +933,6 @@ let default =
829
933
; dune_diagnostics = Some { enable = true }
830
934
; syntax_documentation = Some { enable = false }
831
935
; merlin_jump_code_actions = Some { enable = false }
936
+ ; shorten_merlin_diagnostics = Some { enable = false }
832
937
}
833
938
;;
0 commit comments