11open Import
22open Import.Json.Conv
33
4+ module InlayHints = struct
5+ type t =
6+ { hint_pattern_variables : bool
7+ [@ key "hintPatternVariables" ] [@ default false ]
8+ ; hint_let_bindings : bool [@ key "hintLetBindings" ] [@ default false ]
9+ }
10+ [@@ deriving_inline yojson ] [@@ yojson.allow_extra_fields]
11+
12+ let _ = fun (_ : t ) -> ()
13+
14+
15+ let t_of_yojson =
16+ (let _tp_loc = " ocaml-lsp-server/src/config_data.ml.InlayHints.t" in
17+ function
18+ | `Assoc field_yojsons as yojson ->
19+ let hint_pattern_variables_field = ref Ppx_yojson_conv_lib.Option. None
20+ and hint_let_bindings_field = ref Ppx_yojson_conv_lib.Option. None
21+ and duplicates = ref []
22+ and extra = ref [] in
23+ let rec iter =
24+ function
25+ | (field_name , _field_yojson )::tail ->
26+ ((match field_name with
27+ | "hintPatternVariables" ->
28+ (match Ppx_yojson_conv_lib. (! )
29+ hint_pattern_variables_field
30+ with
31+ | Ppx_yojson_conv_lib.Option. None ->
32+ let fvalue = bool_of_yojson _field_yojson in
33+ hint_pattern_variables_field :=
34+ (Ppx_yojson_conv_lib.Option. Some fvalue)
35+ | Ppx_yojson_conv_lib.Option. Some _ ->
36+ duplicates := (field_name ::
37+ (Ppx_yojson_conv_lib. (! ) duplicates)))
38+ | "hintLetBindings" ->
39+ (match Ppx_yojson_conv_lib. (! ) hint_let_bindings_field
40+ with
41+ | Ppx_yojson_conv_lib.Option. None ->
42+ let fvalue = bool_of_yojson _field_yojson in
43+ hint_let_bindings_field :=
44+ (Ppx_yojson_conv_lib.Option. Some fvalue)
45+ | Ppx_yojson_conv_lib.Option. Some _ ->
46+ duplicates := (field_name ::
47+ (Ppx_yojson_conv_lib. (! ) duplicates)))
48+ | _ -> () );
49+ iter tail)
50+ | [] -> () in
51+ (iter field_yojsons;
52+ (match Ppx_yojson_conv_lib. (! ) duplicates with
53+ | _ ::_ ->
54+ Ppx_yojson_conv_lib.Yojson_conv_error. record_duplicate_fields
55+ _tp_loc (Ppx_yojson_conv_lib. (! ) duplicates) yojson
56+ | [] ->
57+ (match Ppx_yojson_conv_lib. (! ) extra with
58+ | _ ::_ ->
59+ Ppx_yojson_conv_lib.Yojson_conv_error. record_extra_fields
60+ _tp_loc (Ppx_yojson_conv_lib. (! ) extra) yojson
61+ | [] ->
62+ let (hint_pattern_variables_value, hint_let_bindings_value)
63+ =
64+ ((Ppx_yojson_conv_lib. (! ) hint_pattern_variables_field),
65+ (Ppx_yojson_conv_lib. (! ) hint_let_bindings_field)) in
66+ {
67+ hint_pattern_variables =
68+ ((match hint_pattern_variables_value with
69+ | Ppx_yojson_conv_lib.Option. None -> false
70+ | Ppx_yojson_conv_lib.Option. Some v -> v));
71+ hint_let_bindings =
72+ ((match hint_let_bindings_value with
73+ | Ppx_yojson_conv_lib.Option. None -> false
74+ | Ppx_yojson_conv_lib.Option. Some v -> v))
75+ })))
76+ | _ as yojson ->
77+ Ppx_yojson_conv_lib.Yojson_conv_error. record_list_instead_atom _tp_loc
78+ yojson : Ppx_yojson_conv_lib.Yojson.Safe. t -> t)
79+
80+ let _ = t_of_yojson
81+
82+ let yojson_of_t =
83+ (function
84+ | { hint_pattern_variables = v_hint_pattern_variables
85+ ; hint_let_bindings = v_hint_let_bindings
86+ } ->
87+ let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in
88+ let bnds =
89+ let arg = yojson_of_bool v_hint_let_bindings in
90+ (" hintLetBindings" , arg) :: bnds
91+ in
92+ let bnds =
93+ let arg = yojson_of_bool v_hint_pattern_variables in
94+ (" hintPatternVariables" , arg) :: bnds
95+ in
96+ `Assoc bnds
97+ : t -> Ppx_yojson_conv_lib.Yojson.Safe. t)
98+
99+ let _ = yojson_of_t
100+
101+ [@@@ end]
102+ end
103+
4104module Lens = struct
5105 type t = { enable : bool [@ default true ] }
6106 [@@ deriving_inline yojson ] [@@ yojson.allow_extra_fields]
@@ -150,6 +250,8 @@ type t =
150250 [@ default None ] [@ yojson_drop_default ( = )]
151251 ; extended_hover : ExtendedHover .t Json.Nullable_option .t
152252 [@ key "extendedHover" ] [@ default None ] [@ yojson_drop_default ( = )]
253+ ; inlay_hints : InlayHints .t Json.Nullable_option .t
254+ [@ key "inlayHints" ] [@ default None ] [@ yojson_drop_default ( = )]
153255 }
154256[@@ deriving_inline yojson ] [@@ yojson.allow_extra_fields]
155257
@@ -161,6 +263,7 @@ let t_of_yojson =
161263 | `Assoc field_yojsons as yojson -> (
162264 let codelens_field = ref Ppx_yojson_conv_lib.Option. None
163265 and extended_hover_field = ref Ppx_yojson_conv_lib.Option. None
266+ and inlay_hints_field = ref Ppx_yojson_conv_lib.Option. None
164267 and duplicates = ref []
165268 and extra = ref [] in
166269 let rec iter = function
@@ -186,6 +289,17 @@ let t_of_yojson =
186289 extended_hover_field := Ppx_yojson_conv_lib.Option. Some fvalue
187290 | Ppx_yojson_conv_lib.Option. Some _ ->
188291 duplicates := field_name :: Ppx_yojson_conv_lib. ( ! ) duplicates)
292+ | "inlayHints" -> (
293+ match Ppx_yojson_conv_lib. ( ! ) inlay_hints_field with
294+ | Ppx_yojson_conv_lib.Option. None ->
295+ let fvalue =
296+ Json.Nullable_option. t_of_yojson
297+ InlayHints. t_of_yojson
298+ _field_yojson
299+ in
300+ inlay_hints_field := Ppx_yojson_conv_lib.Option. Some fvalue
301+ | Ppx_yojson_conv_lib.Option. Some _ ->
302+ duplicates := field_name :: Ppx_yojson_conv_lib. ( ! ) duplicates)
189303 | _ -> () );
190304 iter tail
191305 | [] -> ()
@@ -205,9 +319,10 @@ let t_of_yojson =
205319 (Ppx_yojson_conv_lib. ( ! ) extra)
206320 yojson
207321 | [] ->
208- let codelens_value, extended_hover_value =
322+ let codelens_value, extended_hover_value, inlay_hints_value =
209323 ( Ppx_yojson_conv_lib. ( ! ) codelens_field
210- , Ppx_yojson_conv_lib. ( ! ) extended_hover_field )
324+ , Ppx_yojson_conv_lib. ( ! ) extended_hover_field
325+ , Ppx_yojson_conv_lib. ( ! ) inlay_hints_field )
211326 in
212327 { codelens =
213328 (match codelens_value with
@@ -217,6 +332,10 @@ let t_of_yojson =
217332 (match extended_hover_value with
218333 | Ppx_yojson_conv_lib.Option. None -> None
219334 | Ppx_yojson_conv_lib.Option. Some v -> v)
335+ ; inlay_hints =
336+ (match inlay_hints_value with
337+ | Ppx_yojson_conv_lib.Option. None -> None
338+ | Ppx_yojson_conv_lib.Option. Some v -> v)
220339 }))
221340 | _ as yojson ->
222341 Ppx_yojson_conv_lib.Yojson_conv_error. record_list_instead_atom
@@ -228,8 +347,21 @@ let _ = t_of_yojson
228347
229348let yojson_of_t =
230349 (function
231- | { codelens = v_codelens ; extended_hover = v_extended_hover } ->
350+ | { codelens = v_codelens
351+ ; extended_hover = v_extended_hover
352+ ; inlay_hints = v_inlay_hints
353+ } ->
232354 let bnds : (string * Ppx_yojson_conv_lib.Yojson.Safe.t) list = [] in
355+ let bnds =
356+ if None = v_inlay_hints then bnds
357+ else
358+ let arg =
359+ (Json.Nullable_option. yojson_of_t InlayHints. yojson_of_t)
360+ v_inlay_hints
361+ in
362+ let bnd = (" inlayHints" , arg) in
363+ bnd :: bnds
364+ in
233365 let bnds =
234366 if None = v_extended_hover then bnds
235367 else
@@ -259,4 +391,6 @@ let _ = yojson_of_t
259391let default =
260392 { codelens = Some { enable = false }
261393 ; extended_hover = Some { enable = false }
394+ ; inlay_hints =
395+ Some { hint_pattern_variables = true ; hint_let_bindings = true }
262396 }
0 commit comments