Skip to content

Commit b7faaf2

Browse files
authored
Set inlay hints enabled by default for function params (#1517)
* Set `inlay hints` enable by default for `function params` * Apply formatting
1 parent 672bcff commit b7faaf2

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

ocaml-lsp-server/src/config_data.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module InlayHints = struct
55
type t =
66
{ hint_pattern_variables : bool [@key "hintPatternVariables"] [@default false]
77
; hint_let_bindings : bool [@key "hintLetBindings"] [@default false]
8-
; hint_function_params : bool [@key "hintFunctionParams"] [@default false]
8+
; hint_function_params : bool [@key "hintFunctionParams"] [@default true]
99
}
1010
[@@deriving_inline yojson] [@@yojson.allow_extra_fields]
1111

@@ -81,7 +81,7 @@ module InlayHints = struct
8181
| Ppx_yojson_conv_lib.Option.Some v -> v)
8282
; hint_function_params =
8383
(match hint_function_params_value with
84-
| Ppx_yojson_conv_lib.Option.None -> false
84+
| Ppx_yojson_conv_lib.Option.None -> true
8585
| Ppx_yojson_conv_lib.Option.Some v -> v)
8686
}))
8787
| _ as yojson ->

ocaml-lsp-server/test/e2e-new/inlay_hints.ml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let apply_inlay_hints
55
?range
66
?(hint_pattern_variables = false)
77
?(hint_let_bindings = false)
8-
?(hint_function_params = true)
8+
?hint_function_params
99
~source
1010
()
1111
=
@@ -25,18 +25,19 @@ let apply_inlay_hints
2525
let textDocument = TextDocumentIdentifier.create ~uri in
2626
InlayHintParams.create ~textDocument ~range ()
2727
in
28+
let regular_config =
29+
[ "hintPatternVariables", `Bool hint_pattern_variables
30+
; "hintLetBindings", `Bool hint_let_bindings
31+
]
32+
@
33+
match hint_function_params with
34+
| None -> []
35+
| Some hint_function_params -> [ "hintFunctionParams", `Bool hint_function_params ]
36+
in
2837
let inlay_hints =
2938
Test.run_request
3039
~prep:(fun client -> Test.openDocument ~client ~uri ~source)
31-
~settings:
32-
(`Assoc
33-
[ ( "inlayHints"
34-
, `Assoc
35-
[ "hintPatternVariables", `Bool hint_pattern_variables
36-
; "hintLetBindings", `Bool hint_let_bindings
37-
; "hintFunctionParams", `Bool hint_function_params
38-
] )
39-
])
40+
~settings:(`Assoc [ "inlayHints", `Assoc regular_config ])
4041
(InlayHint request)
4142
in
4243
match inlay_hints with

0 commit comments

Comments
 (0)